Skip to content

fix: componentcreator: avoid wrapping children in array for createelement (#552)#945

Open
frano-m wants to merge 1 commit into
mainfrom
fran/552-componentcreator-children-array
Open

fix: componentcreator: avoid wrapping children in array for createelement (#552)#945
frano-m wants to merge 1 commit into
mainfrom
fran/552-componentcreator-children-array

Conversation

@frano-m
Copy link
Copy Markdown
Contributor

@frano-m frano-m commented May 28, 2026

Summary

  • ComponentCreator previously passed children to React.createElement wrapped in a one-element array literal. React treats an array third-arg as a "list" of children and requires a key on each item, which surfaces as the "Each child in a list should have a unique 'key' prop" warning from any wrapping component (MUI Tooltip is a common one), and as a "prop children is not supported" prop-type warning on components that don't accept children (e.g. MuiChip).
  • Pass the single child value directly to createElement instead. Behavior is unchanged for view builders that return a single child (the common case); view builders that return an array continue to work because React still treats arrays as lists either way.

Test plan

  • npm run check-format — clean
  • npm run lint — clean
  • npm run test-compile — clean
  • npm test — 447/447
  • Smoke-tested in data-biosphere — Files-tab download tooltip no longer warns. (Surfaced a separate latent bug in AzulFileDownload ref-forwarding, tracked in AzulFileDownload: forward ref so it can be used as a Tooltip child without a span wrapper #944.)
  • Smoke-tested in brc-analytics — priority-pathogen Tooltip + Chip in organism / genome tables still renders correctly.

Closes #552

🤖 Generated with Claude Code

…ment (#552)

react.createelement treats a literal array passed as the third argument
as a list of children, requiring a key on each item. when c.component
is a tooltip or any element that renders its children, this surfaces
as a "each child in a list should have a unique key prop" warning,
and components that don't accept children (e.g. muichip) issue a
"prop children is not supported" prop-type warning.

pass the single child value directly instead of wrapping it in a
one-element array literal. behavior is unchanged for viewbuilders
that return a single child (the common case); viewbuilders that
already return an array continue to work as react still treats
arrays as lists either way.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 07:30
Copy link
Copy Markdown
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

This PR fixes how ComponentCreator passes children into React.createElement to avoid React treating a single child as a keyed “list” (and the resulting warnings in wrappers like MUI Tooltip and components that don’t accept children).

Changes:

  • Stop wrapping the children argument in a one-element array when calling React.createElement.
  • Pass children (or props.children) directly as the third argument to createElement, preserving expected behavior for single-child and array-children cases.

@frano-m frano-m marked this pull request as ready for review May 28, 2026 07:36
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.

Fix ComponentCreator to Avoid Wrapping Children in Array for React.createElement

3 participants