Skip to content

fix(Card): Card.Content finds a cover or a title before it by their real names - #28

Closed
joelmsanto wants to merge 1 commit into
feature/temporal-migrationfrom
fix/card-content-sibling-names-2026-11-10
Closed

joelmsanto wants to merge 1 commit into
feature/temporal-migrationfrom
fix/card-content-sibling-names-2026-11-10

Conversation

@joelmsanto

Copy link
Copy Markdown
Collaborator

Problem

Card lists its children by child.type.displayName. The exported Card.Cover and Card.Title are wrapped by withInternalTheme, whose withTheme (@callstack/react-theme-provider 3.0.9, createWithTheme.js) names them withTheme(Card.Cover) and withTheme(Card.Title).

Card.Content compared them with the literals 'withInternalTheme(CardCover)' and 'withInternalTheme(CardTitle)', which never matched (the same code is in upstream 5.0.0 to 5.12.5). So a Card.Content after a cover or a title, when it is neither the first nor the last child, got no top spacing, and its text sat on the image. Seen in CustomerApp's welcome (auth): Card.Cover → Card.Content → Card.Actions.

Fix

Card.Content reads the exported components' own displayName, so the names cannot drift apart again. It is typed by React.ComponentType, with no cast and no import cycle.

Upstream replaced this sibling lookup with context in callstack#5076 (2026-10-12); this is the minimal fix on the 5.12 line.

Tests

src/components/__tests__/Card/Card.test.js: a Card.Content after a Card.Cover, and after a Card.Title, takes the card's top spacing (spacing.x4).

Not run: this checkout has no node_modules, and installing needs the private registry, which answers 403 from the author's machine.

Release

Publishing 5.12.14 and pinning it in CustomerApp are the owner's steps.

🤖 Generated with Claude Code

…eal names

Card lists its children by `child.type.displayName`. The exported Card.Cover and
Card.Title are wrapped by withInternalTheme, whose withTheme
(@callstack/react-theme-provider) names them `withTheme(Card.Cover)` and
`withTheme(Card.Title)`. Card.Content compared them with the literals
'withInternalTheme(CardCover)' and 'withInternalTheme(CardTitle)', which never
matched (as in upstream 5.0.0 to 5.12.5), so a Card.Content after a cover or a
title, when neither first nor last child, got no top spacing and its text sat on
the image. It now reads the exported components' own displayName, so the names
cannot drift apart again.

Card.test.js: a Card.Content after a Card.Cover, and after a Card.Title, takes the
card's top spacing (spacing.x4).

Upstream replaced this sibling lookup with context in callstack#5076 (2026-10-12); this is
the minimal fix on the 5.12 line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joelmsanto

Copy link
Copy Markdown
Collaborator Author

Closed at the owner's request: the change is reverted. The card composition in CustomerApp follows the app's existing card with media (VendorListItem: Card.Cover, Card.Title, Card.Content) instead.

@joelmsanto joelmsanto closed this Nov 10, 2026
@joelmsanto
joelmsanto deleted the fix/card-content-sibling-names-2026-11-10 branch November 10, 2026 21:35
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.

1 participant