Skip to content

fix(renderer): prevent key from being spread via props#1620

Merged
Hyperkid123 merged 1 commit into
data-driven-forms:masterfrom
asirvadAbrahamVarghese:prevent-key-prop-spread
Jul 2, 2026
Merged

fix(renderer): prevent key from being spread via props#1620
Hyperkid123 merged 1 commit into
data-driven-forms:masterfrom
asirvadAbrahamVarghese:prevent-key-prop-spread

Conversation

@asirvadAbrahamVarghese

Copy link
Copy Markdown
Contributor

Description
When the schema contains a key field, it gets spread into the SingleField component, and triggers "key being spread" warning (React 18.3.0+ change: https://github.com/react/react/releases/tag/v18.3.0) - we rely on dynamic key values to force the component to re-render

Note: this only happens when Babel compiles JSX using the modern _jsx or _jsxDEV runtime (i.e., with runtime: 'automatic'), React emits the following runtime warning:
"Warning: A props object containing a 'key' prop is being spread into JSX."

Before:
image

After:
image

Please include a summary of the change.

Schema (if applicable)

{
  fields: [
    {
      component: 'text-field',
      name: 'field1',
      label: 'Field 1 (no key)',
    },
    {
      component: 'text-field',
      name: 'field2',
      label: 'Field 2 (HAS KEY PROPERTY)',
      key: 'my-custom-key-123',
    },
  ],
};

Checklist: (please see documentation page for more information)

  • Yarn build passes
  • Yarn lint passes
  • Yarn test passes
  • Test coverage for new code (if applicable)
  • Documentation update (if applicable)
  • Correct commit message
    • format fix|feat({scope}): {description}
    • i.e. fix(pf3): wizard correctly handles next button
    • fix will release a new _._.X version
    • feat will release a new _.X._ version (use when you introduce new features)
      • we want to avoid any breaking changes, please contact us, if there is no way how to avoid them
    • scope: package
    • if you update the documentation or tests, do not use this format
      • i.e. Fix button on documenation example page

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

@asirvadAbrahamVarghese is attempting to deploy a commit to the data-driven-forms Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
react-forms Ready Ready Preview, Comment Jul 2, 2026 9:00am

@Hyperkid123 Hyperkid123 merged commit 23af064 into data-driven-forms:master Jul 2, 2026
3 checks passed
@asirvadAbrahamVarghese

Copy link
Copy Markdown
Contributor Author

@Hyperkid123
Thanks for merging! Looks like the release packages job is failing on master so could you please trigger a release for this fix?

@Hyperkid123

Copy link
Copy Markdown
Member

@asirvadAbrahamVarghese thanks for noticing. I'll see what the issue is.

@Hyperkid123

Copy link
Copy Markdown
Member

@asirvadAbrahamVarghese should be fixed now. Sorry for the inconvenience.

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.

2 participants