Issues when using New-UDButton -OnClick with Multiple Sessions

Hi Team,

We have a simple app/dashboard where we get a computer name from a textbox and the user clicks a button and it performs simple tasks (create a folder with that PC name lets say). What we are running into during testing is that when the app code is updated, app is restarted and refresh button is clicked (within PU), many times the onclick event does nothing (no errors, no feedback).

At this point only way to make it work again is to make sure to close all tabs and open a new session. Is this behavior expected? I saw a similar issue saying endpoints and such stop working after 5 tabs/session from one user. We at most had 2 sessions and on click would fail to work leading to a frustrating experience from one of my team members trying to learn and code PU apps. We are able to recreate in 4.0.9 and latest 4.1.8 Any suggestions are appreciated. Thanks.

Product: PowerShell Universal
Version: 4.1.8

Little more clarification on this:

  • This is tested on version 4.1.7 not 4.1.8

What’s happening is if you edit a dashboard/page, after the reload certain elements on the page do not work. These include Forms and the submit button, dynamic regions, etc.

If you then navigate to a different page in the same dashboard then navigate back to the original page with the issue, everything loads fine.

Working around it for now but highlighting it as an issue that can lead to frustration if you don’t know how to work around it while editing an app/dashboard.

I have not seen this type of behavior myself and I am using a fair few amount of elements. Do you have any code you can share that we could review? Not sure how to reproduce this otherwise.

Here’s a simple one:

If you edit dashboard, save and reload, when your tab refreshes the dynamic table will not be visible (first clue its broken).

If you navigate to the “Blank” page, then navigate back to “Hello World” it loads properly again.

Not Working:

Working:

$Pages = @()

$Pages += New-UDPage -Name 'Hello World' -Content {
	New-UDPaper -Id "ppr-root" -Style @{"max-width"="500px";} -Children {
		New-UDGrid -Container -Children {
			New-UDGrid -MediumSize 12 -Children {
				New-UDTypography -Text "Enter a hostname"
			}
			New-UDGrid -MediumSize 12 -Children {
				New-UDTextbox -Id "txt_hostname" -Placeholder "Enter a Hostname" -FullWidth -Multiline
			}
			New-UDGrid -MediumSize 6 -Children {
				New-UDButton -Text "Create Folder(s)" -OnClick {
					$Hostname = (Get-UDElement -Id "txt_hostname").Value
					Show-UDToast -Message "Hostname: $HostName" -Duration 1000 -Position topCenter
					$StatusObj = [PSCustomObject] @{
						Hostname = $Hostname
						Status = "Queued"
					}
					Sync-UDElement "dyn_tbl_results" -ArgumentList $StatusObj
				}
			}
		}
	}
	New-UDDynamic -Id "dyn_tbl_results" -Content {
		New-UDTable -Title "Folder Create - Results" -Data $ArgumentList -Columns @(
            New-UDTableColumn -Property Hostname
            New-UDTableColumn -Property Status
        )
	}
}

$Pages += New-UDPage -Name "Blank" -Content {
	New-UDTypography -Text "Hello World"
}

New-UDApp -Title "Hello World" -Pages $Pages

I threw the code into my Dev instance of PSU, unfortunately I could not reproduce anything. I made multiple changes and the element rendered correctly each time.

The only other difference I can think of is how it is hosted. I tested this in PSU Desktop 4.1.7 on Google Chrome, as that is where I do most of my dev work.

How are you hosting it? Service, IIS, or Desktop? Chrome\Edge\Firefox?

If you try a different host or browser do you get the same results?

Hosting it via Windows Service through the MSI install. I tried Firefox and Edge as well, same results in all browsers.If you are unable to reproduce, I’ll have a look at our config, perhaps some setting we added that’s causing this. Will report back If I find anything.