Skip to content

Fix I18nLabel objects rendered as React children causing 11 CI test failures#880

Merged
hotlong merged 3 commits intomainfrom
copilot/fix-ci-errors-a2dfe0e6-f121-49c7-b4ed-39b43102d39e
Feb 27, 2026
Merged

Fix I18nLabel objects rendered as React children causing 11 CI test failures#880
hotlong merged 3 commits intomainfrom
copilot/fix-ci-errors-a2dfe0e6-f121-49c7-b4ed-39b43102d39e

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

CRM app metadata uses I18nLabel objects ({key, defaultValue}) for label and description fields. Several components rendered these directly as React children, crashing with Objects are not valid as a React child.

Component fixes — wrap labels with resolveI18nLabel()

  • ConsoleLayout.tsxactiveApp.label passed unresolved to AppHeader appName prop and branding title interpolation
  • AppSidebar.tsx — app switcher dropdown (line 304) and condensed nav item labels (line 533)
  • CommandPalette.tsx — all item.label / app.label in <span> children and value string props
  • DashboardRenderer.tsxwidget.title, schema.title, schema.description rendered as children; added local resolveLabel helper since @object-ui/react doesn't export the utility
  • AppManagementPage.tsxapp.label and app.description in system page listing

Test fix

  • SpecCompliance.test.tsxtypeof app.label / app.description assertions updated to accept I18nLabel objects with shape validation:
expect(['string', 'object']).toContain(typeof app.label);
if (typeof app.label === 'object') {
    expect(app.label).toHaveProperty('key');
}

Full suite: 366 files, 6723 tests passing, 0 failures.

Original prompt

fix all ci errors


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 26, 2026 7:34pm
objectui-demo Ready Ready Preview, Comment Feb 26, 2026 7:34pm
objectui-storybook Ready Ready Preview, Comment Feb 26, 2026 7:34pm

Request Review

… CommandPalette, DashboardRenderer, AppManagementPage, and SpecCompliance test

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix all CI errors Fix I18nLabel objects rendered as React children causing 11 CI test failures Feb 26, 2026
@hotlong hotlong marked this pull request as ready for review February 27, 2026 03:19
Copilot AI review requested due to automatic review settings February 27, 2026 03:19
@hotlong hotlong merged commit 1afdb33 into main Feb 27, 2026
4 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes console/plugin UI crashes caused by rendering I18nLabel objects ({ key, defaultValue }) directly as React children, by resolving these labels to strings before rendering and adjusting spec compliance tests accordingly.

Changes:

  • Updated multiple Console UI surfaces (layout, sidebar, command palette, system app listing) to render I18nLabel via resolveI18nLabel() instead of raw objects.
  • Updated Dashboard plugin renderer to safely resolve widget/dashboard titles and descriptions before rendering.
  • Relaxed spec compliance tests to accept label / description as either strings or I18nLabel objects.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/plugin-dashboard/src/DashboardRenderer.tsx Adds a local label resolver and applies it to widget/schema titles/descriptions to prevent React child crashes.
apps/console/src/pages/system/AppManagementPage.tsx Resolves app labels/descriptions when rendering the app management list.
apps/console/src/components/ConsoleLayout.tsx Resolves active app label before passing to header/branding title.
apps/console/src/components/CommandPalette.tsx Resolves labels for command items and search values to avoid rendering I18nLabel objects.
apps/console/src/components/AppSidebar.tsx Resolves app switcher and condensed nav labels before rendering.
apps/console/src/tests/SpecCompliance.test.tsx Updates compliance assertions to accept I18nLabel objects for label/description.

Comment on lines +16 to +21
/** Resolve an I18nLabel (string or {key, defaultValue}) to a plain string. */
function resolveLabel(label: string | { key?: string; defaultValue?: string } | undefined): string | undefined {
if (label === undefined || label === null) return undefined;
if (typeof label === 'string') return label;
return label.defaultValue || label.key;
}
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In resolveLabel, the object shape ({ key?: string; defaultValue?: string }) doesn’t match the repo’s I18nLabel spec (key is required and params may be present). Consider typing this as string | I18nLabel | undefined (import I18nLabel from @object-ui/types) and keeping the resolver aligned with that shape so it won’t drift from the spec over time.

Copilot uses AI. Check for mistakes.
Comment on lines 27 to +31
expect(app.label).toBeDefined();
expect(typeof app.label).toBe('string');
expect(['string', 'object']).toContain(typeof app.label);
if (typeof app.label === 'object') {
expect(app.label).toHaveProperty('key');
}
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated label type check treats null as an object (typeof null === 'object'). Since toBeDefined() doesn’t exclude null, this test can behave unexpectedly. Consider explicitly asserting app.label/app.description are not null before the object-shape checks (and optionally that key is a string).

Copilot uses AI. Check for mistakes.
Comment on lines +208 to +212
<LayoutGrid className="h-4 w-4" />
</div>
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<span className="font-medium truncate">{app.label || app.name}</span>
<span className="font-medium truncate">{resolveI18nLabel(app.label) || app.name}</span>
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Within this app card, the checkbox aria-label is still built from app.label directly, which can stringify to "[object Object]" when label is an I18nLabel. Use resolveI18nLabel(app.label) (or fallback to app.name) for the aria-label so screen readers get a meaningful label.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants