Skip to content

fix(admin): remove "key" from REACT_INTERNAL_PROPS in generate-schema - #256

Merged
JonasJesus42 merged 1 commit into
mainfrom
fix/react-internal-props-key
Jun 18, 2026
Merged

JonasJesus42 merged 1 commit into
mainfrom
fix/react-internal-props-key

Conversation

@JonasJesus42

@JonasJesus42 JonasJesus42 commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Removes "key" from REACT_INTERNAL_PROPS in scripts/generate-schema.ts
  • "key" was being filtered as if it were React's special JSX reconciliation prop, but it is a common field name in data interfaces

Root cause

REACT_INTERNAL_PROPS is used inside typeToJsonSchema() which is called recursively for all nested object types. Any TypeScript interface property named key was silently dropped from the generated JSON Schema — including legitimate fields like SelectedFacet.key.

Example in a loader Props: selectedFacets?: { key: string; value: string }[]

Generated schema before this fix (only value, key missing):

{ "type": "array", "items": { "properties": { "value": { "type": "string" } } } }

Generated schema after this fix:

{ "type": "array", "items": { "properties": { "key": { "type": "string" }, "value": { "type": "string" } } } }

Why removing "key" is safe

React's JSX key prop is a JSX attribute — it cannot be declared as an explicit TypeScript interface property and is never present in a Props interface. Filtering it at the TypeScript type level only harms legitimate data interfaces.

The remaining entries in REACT_INTERNAL_PROPS (ref, then, catch, finally, $$typeof, _owner, _store) correctly appear in React internal types and should stay filtered.

Fixes

DECO-5296 Bug #4

Generated with Claude Code


Summary by cubic

Stop dropping legitimate key fields in generated JSON Schema by removing "key" from REACT_INTERNAL_PROPS in scripts/generate-schema.ts. Fixes DECO-5296 by ensuring objects like { key: string; value: string } keep the key property.

  • Bug Fixes
    • typeToJsonSchema() now preserves key at all nesting levels; React’s JSX key isn’t a TS interface prop. Other internal props (ref, then, catch, finally, $$typeof, _owner, _store) remain filtered.

Written for commit ee929cc. Summary will update on new commits.

Review in cubic

"key" was listed as a React-internal prop to skip during schema generation.
But unlike "ref" or "$$typeof", React's JSX "key" is a special attribute
that never appears as an explicit TypeScript interface property — so filtering
it drops legitimate "key" fields from data interfaces.

Example breakage: a loader Props with `selectedFacets?: { key: string;
value: string }[]` generated a schema with only "value" — the "key" field
(e.g. "productClusterIds") was silently lost, blocking CMS editing.

Fixes DECO-5296 bug #4.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@JonasJesus42
JonasJesus42 requested a review from a team June 18, 2026 18:31
@JonasJesus42
JonasJesus42 merged commit a75c170 into main Jun 18, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 6.10.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant