Product: PowerShell Universal
Version: 2.0.3
Working with the code below to try and figure out Set-UDElement. I understand I’m probably not using the command correctly but having trouble when the cmdlet document doesn’t seem to be complete. I found a an older version of the command that refers to attributes instead of properties so I assume it has been updated? I found the code example in another post and slightly modified it.
New-UDDashboard -Title "TEST" -Content {
New-UDTypography -Id 'text' -Text "TEST"
New-UDButton -Id 'Editable' -Text "EditText" -OnClick {
Set-UDElement -Id 'text' -Properties @{text = 'Randomized'}
Set-UDElement -Id "Editable" -Properties @{text = (Get-random)}
}
New-UDButton -Text "Hidemeh" -OnClick {
Set-UDElement -Id 'text' -Properties @{text = 'Hidden'}
Set-UDElement -Id "Editable" -Properties @{hidden = $true}
}
New-UDButton -Text "Showmeh" -OnClick {
Set-UDElement -Id 'text' -Properties @{text = 'Shown'}
Set-UDElement -Id "Editable" -Properties @{hidden = $false}
}
}
Problem 1: The ‘EditText’ button does work and changes the button text to a random number but the UDTypography text of ‘TEST’ is not updated to ‘Randomized’. The ‘Showmeh’ button also fails to update the UDTypography. Why?
Problem 2: The ‘Hidemeh’ button when clicked causes the React error below. When the minified error is decoded the error is:
Objects are not valid as a React child (found: Error: Minified React error #310; visit https://reactjs.org/docs/error-decoder.html?invariant=310 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.). If you meant to render a collection of children, use an array instead.
Is this a problem with version 2.0.3 or am I an idiot? I posted about this same error in another post but have not gotten a reply on it and since I am seeing it again I will include it here.