Skip to content

console: duplicate React keys during app-shell boot — 'Encountered two children with the same key' #2931

Description

@os-zhuang

Found while browser-verifying #2927 (PR #2930). Pre-existing and unrelated to that change — filed rather than left buried, per AGENTS.md #10.

Symptom

A hard load of any console route logs React's duplicate-key error, four times:

Encountered two children with the same key, `%s`. Keys should be unique so that
components maintain their identity across updates. Non-unique keys may cause
children to be duplicated and/or omitted — the behavior is unsupported and
could change in a future version.

This is an error, not a warning, and React is explicit that the resulting behaviour is unsupported: siblings sharing a key can be duplicated or omitted, and state can attach to the wrong sibling.

Repro

  1. Backend on any port (pnpm --filter @objectstack/example-showcase dev -- --fresh -p <port> in framework).
  2. DEV_PROXY_TARGET=http://localhost:<port> pnpm --filter @object-ui/console dev.
  3. Sign in, hard-load /system/approvals, read the browser console.

What has already been ruled out

  • Not from ApprovalsInboxPage. It reproduces identically with that file swapped back to its main version, and both of its filter dropdowns (processOptions / objectOptions, the only index-free .map keys on the page) are Set-deduped by construction.
  • Not from a route re-mount. Hooking console.error and then SPA-navigating away from and back to /system/approvals produces zero warnings. It fires only on the initial full page load, which points at the app-shell bootstrap (nav / sidebar / topbar rendering before data settles) rather than at any one page.

Suggested next step

Hook console.error before React mounts (e.g. at the top of main.tsx behind a dev flag) so the owner component name in the error's trailing argument is captured, rather than truncated as it is in devtools. That should name the offending .map directly.

Refs #2927, #2930.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions