Skip to content

fix(card): avoid cloning Fragment children#5026

Open
wanxiankai wants to merge 1 commit into
callstack:mainfrom
wanxiankai:codex/fix-card-fragment-props
Open

fix(card): avoid cloning Fragment children#5026
wanxiankai wants to merge 1 commit into
callstack:mainfrom
wanxiankai:codex/fix-card-fragment-props

Conversation

@wanxiankai

Copy link
Copy Markdown

Motivation

Card and Card.Actions clone their valid element children to add layout metadata and action styling. React Fragments only accept key and children, so cloning a Fragment with index, total, siblings, borderRadiusStyles, compact, mode, or style produces invalid-prop warnings or runtime errors.

This change leaves Fragment children untouched while preserving the existing prop injection for regular Card children. It also adds regression coverage for both the top-level Card and nested Card.Actions paths reported in the issue.

Related issue

Fixes #4710

Test plan

  • yarn test --runInBand --watchman=false — 55 suites passed; 734 tests passed, 1 skipped; 169 snapshots passed
  • yarn typecheck
  • yarn lint
  • yarn prepack

The regression tests render Fragment children through Card and Card.Actions, verify their content remains visible, and verify that Card-specific props are not added to the Fragment.

@wanxiankai wanxiankai marked this pull request as ready for review July 11, 2026 15:52
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.

Card component injects invalid props into React.Fragment children

1 participant