Bug with UDDynamic

Looks like there is a bug in this, if I have multiple Items within the content, only the first item loads.

Also Dynamic is slow to load

Any idea?

code being used:

New-UDForm -Content {
New-UDSelect -id selectaclient -Label “Select a client” -option {
New-UDSelectOption -name “Select a client” -Value 0
foreach ($RDMvault in $Cache:RDMvaults)
{
New-UDSelectOption -name $RDMvault.name -Value $RDMvault.name
}
}-OnChange {
$Selectedclient = Cache:RDMvaults | where {.name -like (Get-UDElement -id “selectaclient”)[“value”]}
Set-RDMCurrentRepository $Selectedclient.id
cache:PARDMpasswordLists = Get-RDMSession | where {
.ConnectionType -eq “Credential”} | select name,id
$cache:PLS = 1
Sync-UDElement -id PasswordList
}
New-UDDynamic -id PasswordList -content {
New-UDSelect -id “passswordselect” -Label “Select a Password List” -option {
if ($cache:PLS -eq 0)
{
}else{
New-UDSelectOption -name “Select a password list” -Value 1
foreach ($PARDMpasswordList in $cache:PARDMpasswordLists)
{
New-UDSelectOption -name $PARDMpasswordList.name -Value $PARDMpasswordList.name
}
New-UDTextbox -id ‘Host’ -Label ‘Host’
New-UDTextbox -id ‘Username’ -Label ‘Username’
New-UDTextbox -id ‘Domain’ -Label ‘Domain’
New-UDTextbox -id ‘Password’ -Label ‘Password’ -Type password
New-UDTextbox -id ‘ConfirmPassword’ -Label ‘Confirm Password’ -Type password
}
}
}
}

The textboxes never show up.

I just validated that this works in my environment:

New-UDDashboard -Title "Hello, World!" -Content {
    New-UDButton -Text 'Refresh' -OnClick {
        Sync-UDElement -Id 'Dyn'
    }

    New-UDDynamic -Id 'Dyn' -Content {
        1..(Get-Random -Min 1 -Max 10) | ForEach-Object {
            New-UDTextbox -Label $_
        }
    }
}

What if after that text box you add another one but not via the 4 each? All the textboxes above dont show up

Still working for me.

New-UDDashboard -Title "Hello, World!" -Content {
    New-UDButton -Text 'Refresh' -OnClick {
        Sync-UDElement -Id 'Dyn'
    }

    New-UDDynamic -Id 'Dyn' -Content {
        1..(Get-Random -Min 1 -Max 10) | ForEach-Object {
            New-UDTextbox -Label $_
        }

        New-UDTextBox -Label 'not in loop'
    }


}

Ill have to try again. Maybe it was something on my end…

Looks like it was me, I put them in the UDSelect part

1 Like

When using UDDynamic with UDSelects the UDSelects are very slow to update. UDTables seem to update quickly. Any thoughts on this?

Tables seem to update pretty instantly but select boxes even just removing them takes around 10-15 seconds.

Bumping this for any thoughts

10-15 seconds is a very long time. You’re just using the script above with the cache variables? It’s not calling out to any other service?

Hey,

Its porbably more like 6-8 seconds but still long.

The above does call out to a service that returns pretty instant but I changed it to static variables already populated for testing and I get the same result. Tables however update strait away. Its just selects.

Can you paste a reproducable example here so I can try locally without the call out to the service?

Ok I rebuilt this with no call outs (before I think I had the call outs in the script but was just not using them) and it works pretty instant, So something about the call out is slowing it down. However I have similar callouts that dont have this issue. And when I test the callout in powershell it returns the results pretty instantly.

So not sure how to troubleshoot this now.

Ok yeah defo something about the call out I put a toast and that took a min to update. Need to work out why its taking so long in the code.

If it works fine in a normal powershell session but takes longer in your dashboard, I would try troubleshoot with the following:

  1. Attempt to run it non-interactivly outside the dashboard, say within task scheduler
  2. Test it running with your account and the service account that runs your dashboard.

Also if you havent been, wrap your commands with measure-command -expression { commands here } and see how long it takes.

If you can reproduce the slowdown with either of those methods you know the issue isn’t dashboard related!

Thanks I will try that, I did just make it change to the loading icon and then back so it at least tells the user its working on something so it interacts better now.