Repository navigation
fix(admin): remove "key" from REACT_INTERNAL_PROPS in generate-schema - #256
Merged
Merged
Conversation
"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]>
|
🎉 This PR is included in version 6.10.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"key"fromREACT_INTERNAL_PROPSinscripts/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 interfacesRoot cause
REACT_INTERNAL_PROPSis used insidetypeToJsonSchema()which is called recursively for all nested object types. Any TypeScript interface property namedkeywas silently dropped from the generated JSON Schema — including legitimate fields likeSelectedFacet.key.Example in a loader Props:
selectedFacets?: { key: string; value: string }[]Generated schema before this fix (only
value,keymissing):{ "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
keyprop is a JSX attribute — it cannot be declared as an explicit TypeScript interface property and is never present in aPropsinterface. 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_PROPSinscripts/generate-schema.ts. Fixes DECO-5296 by ensuring objects like{ key: string; value: string }keep thekeyproperty.typeToJsonSchema()now preserveskeyat all nesting levels; React’s JSXkeyisn’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.