Errors with displaying content on a UDPage

Error: Minified React error #31; visit[]=object%20with%20keys%20{pageHeaderEntry%2C%20pageFooterEntry%2C%20autosizeInfo%2C%20shapeInfo%2C%20groupingEntry%2C%20classId2e4f51ef21dd47e99d3c952918aff9cd}&args[]=

React Error Decoder:
Objects are not valid as a React child (found: object with keys {pageHeaderEntry, pageFooterEntry, autosizeInfo, shapeInfo, groupingEntry, classId2e4f51ef21dd47e99d3c952918aff9cd}).

My Code:

$Disks = Get-WmiObject -Class Win32_LogicalDisk -ComputerName SName | Where-Object { .DriveType -eq 3 } |
Format-Table DeviceId, @{n=“Size”;e={[math]::Round($
.size /1GB,1)}}

New-UDCard -Title “Local Disk Information” -Content {$Disks}

Note: There really is a $_ before the .DriveType…just doesn’t show up for some reason.

The error indicates that the data is not in a format that React can handle. Is there a workaround?



It has to be the Format-Table. Change that to a Select-Object

New-UDCard -Title “Disks Info”

New-UdRow {
        New-UdColumn -Size 6 -Content {
            New-UdRow {
                New-UdColumn -Size 12 -Content {
                    New-UdTable -Title "Server Information" -Headers @(" ", " ") -Endpoint {
                            'Computer Name' = $env:COMPUTERNAME
                            'Total Disk Space (C:)' = (Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").Size / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
                            'Total Disk Space (D:)' = (Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").Size / 1GB | ForEach-Object { "$([Math]::Round($_, 2)) GBs " }
                        }.GetEnumerator() | Out-UDTableData -Property @("Name", "Value")

Thanks for the reply. I did change it to Select-Object and still get an error. It is a different error, but still indicative of REACT not being able to deal with the format. I think I will try putting all of this code in the Endpoint scriptblock as I am building out the UDCard.