Skip to content

React #31 error when New-UDTable uses local variable inside New-UDTab -Content #5596

@cradixus

Description

@cradixus

Description of Issue

New-UDTable inside New-UDTab -Content throws Minified React error #31 ("Objects are not valid as a React child") when table data is assigned to a local variable. The identical data works when passed inline. The identical variable works with other components. The identical code works outside of tabs.

Steps to Reproduce

  1. Create a PSU app with the code below (or deploy the attached react-31-error.txt)
  2. Navigate to the page
  3. The page briefly renders the table, then crashes to a white screen with React error #31

Minimal reproduction (crashes):

New-UDTabs -Tabs {
    New-UDTab -Text 'Tab1' -Content {
        $rows = @(
            [PSCustomObject]@{ Name = 'Alice' }
            [PSCustomObject]@{ Name = 'Bob' }
        )
        New-UDTable -Data $rows -Columns @(
            New-UDTableColumn -Property 'Name' -Title 'Name'
        )
    }
}

Same data passed inline (works):

New-UDTabs -Tabs {
    New-UDTab -Text 'Tab1' -Content {
        New-UDTable -Data @(
            [PSCustomObject]@{ Name = 'Alice' }
            [PSCustomObject]@{ Name = 'Bob' }
        ) -Columns @(
            New-UDTableColumn -Property 'Name' -Title 'Name'
        )
    }
}

Isolation Results

The crash requires all three conditions simultaneously. Removing any one prevents it:

Condition removed Code change Result
Remove variable Pass data inline on -Data @(...) Works
Remove New-UDTable Use New-UDElement with same variable Works
Remove New-UDTab Same variable + New-UDTable on bare page Works
Use $Cache: scope Build data before tabs, reference $Cache:Rows in tab Works

Error

Error rendering dashboard
This error is not expected. Please contact Ironman Software support.

Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=[object%20Object] for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

Decoded: "Objects are not valid as a React child (found: [object Object]). If you meant to render a collection of children, use an array instead."

Suspected Cause

It appears that New-UDTab -Content serializes local [PSCustomObject] variables into the React component tree as raw children alongside the intended UD component output. React rejects the non-component objects. When data is passed inline (no local variable) or via $Cache: scope (not a local variable), the serialization does not capture the raw objects.

Attached Reproduction App

The attached react-31-error.txt is a standalone PSU app with 5 pages that demonstrate the issue from different angles:

  • Page 1 (CRASH): Variable + New-UDTable inside tab — the bug
  • Page 2 (OK): Inline data, no variable — proves the variable is the trigger
  • Page 3 (OK): Variable + New-UDElement inside tab — proves New-UDTable is required
  • Page 4 (OK): Variable + New-UDTable outside tab — proves New-UDTab is required
  • Page 5 (OK): $Cache: variable workaround — current mitigation

Version

2026.1.3 (stable)

Severity

Critical — any New-UDTable with locally-scoped data inside New-UDTab crashes the page

Hosting Method

MSI (Windows Service)

Operating System

Windows 11 Pro

Database

SQLite

Licensed

Yes

react-31-error.txt

Features

None.

Additional Environment data

Windows 11 Pro. PowerShell 5, 7 , or Integrated all cause the same issue.

Screenshots/Animations

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    requires triageIssue has not yet been verified by the development team.v5Version 5 issue.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions