Sync-UDElement Works only first time

Product: PowerShell Universal
Version: 1.5.12

Hi

I have a situation where my Sync-UDElement nested in the -OnChange on a UDSelect works the first time, but subsequent selections don’t appear to update my UDElement.

I can confirm all options work the first time, so it doesn’t look like it’s anything to do with the choice made, anyone have any idea what may cause this?

Thanks

Do you have an example? I use onchange frequently with no issue.

I am 1.5.13 but I don’t think there were any changes related to onchange.

Thanks for the reply, yeah it’s really odd as I use it regularly in the same fashion, within the UDSelect that only works first time I have nested UDSelects which sync other elements over and over without issue.

That’s why i thought maybe someone had come across this issue and could shed light, as for an example it would difficult without providing the exact and lengthy code, I’ve tried to replicate using simple versions but can’t, just perplexed that it works the first time

This is the code that’s not updating after the first select, the toast appears correctly after i change the dropdown.

For fun I created a basic setup that mostly copies what you are doing, and it works as expected.

New-UDDashboard -Title "Testing" -Content {
    New-UDContainer -Children {
        New-UDRow -Columns {
            New-UDColumn -LargeSize 2 -Content {

                $Data = @(
                    @{Dessert = 'Ice cream sandwich'}
                    @{Dessert = 'Eclair'}
                    @{Dessert = 'Cupcake'}
                    @{Dessert = 'Gingerbread'}
                ) 

                New-UDSelect -Option {
                    New-UDSelectOption -Name "Select a Dessert" -Value "Select a Dessert"

                    foreach ($dessert in $Data)
                    {
                        New-UDSelectOption -Name $dessert.Dessert -Value $dessert.Dessert
                    }
                } -OnChange {
                    $Session:Dessert = $EventData
                    Show-UDToast -Message "Selected $EventData Template" -Duration 800 -MessageSize 15 -Position topCenter -Theme "Dark"
                    Sync-UDElement -Id 'Desserttxt'
                }
            }

            New-UDColumn -LargeSize 2 -Content {
                New-UDElement -Tag 'div' -Id 'Desserttxt' -Endpoint {
                    New-UdTextbox -Label "Dessert" -Value $Session:Dessert
                }
            }
        }
    }
}

Maybe do some testing with a very basic udelement to see if something in your code is hanging up.

Hello

I have the same problem as MaCCa, the element syncs only once and I don’t know why.
I don’t know since which version it doesn’t work, because i noticed this problem only now, currently I have version 2.11.1

In the log files these two lines are always written when I click on the udselect element

My Script: