Skip to content

[NO-JIRA][BpkCardList] Remove initiallyInViewCardIndex prop#4553

Open
Jimmy cook (jimmycook) wants to merge 2 commits into
mainfrom
nojira-remove-initiallyInViewCardIndex
Open

[NO-JIRA][BpkCardList] Remove initiallyInViewCardIndex prop#4553
Jimmy cook (jimmycook) wants to merge 2 commits into
mainfrom
nojira-remove-initiallyInViewCardIndex

Conversation

@jimmycook
Copy link
Copy Markdown
Contributor

Summary

  • Removes initiallyInViewCardIndex from BpkCardList and the row/rail container, plus the supporting initialPageIndex plumbing through BpkCardListCarousel and usePageScrollSync.
  • Drops the dedicated story, tests, and prop-passes; tests still pass (60/60 in bpk-component-card-list).

Why

The prop ran scrollIntoView from a mount-time useEffect. When the carousel mounts inside a parent that hasn't laid out yet (e.g. AnimateHeight at display: none), the target card has a zero-size box and the scroll silently no-ops, leaving DOM and React state out of sync.

Its sole intended consumer — ExpandedPricingOption in web-platform — hit exactly this and has since switched to a manual ref-based scroll triggered after its AnimateHeight animation completes (IRN-6568, web-platform commit 29b3db2687). Codebase search shows no other consumers, so the prop is dead weight with a misleading API.

Drafted as part of an internal decision doc: ~/.claude/tmp/remove-bpkcardlist-initial-selection.md.

Test plan

  • npx jest packages/backpack-web/src/bpk-component-card-list — 60/60 passing
  • tsc --noEmit clean for packages/backpack-web
  • Storybook smoke check on RowToRail / RowToStack examples
  • Confirm with consuming teams (none expected) that no app references the prop

🤖 Generated with Claude Code

The prop relied on scrollIntoView from a useEffect on mount, which
silently no-ops when the carousel is rendered inside a parent that
hasn't laid out yet (e.g. AnimateHeight at display: none). The sole
intended consumer (ExpandedPricingOption in web-platform) hit exactly
this and has since switched to a manual ref-based scroll triggered
after its parent's animation completes (IRN-6568). No other consumers
exist, so the prop is dead weight with a misleading API.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@skyscanner-backpack-bot
Copy link
Copy Markdown

Visit https://backpack.github.io/storybook-prs/4553 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link
Copy Markdown

skyscanner-backpack-bot Bot commented May 22, 2026

Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.js) were updated, but snapshots weren't. Have you checked that the tests still pass?

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against f0e7f37

@jimmycook Jimmy cook (jimmycook) added major Breaking change minor Non breaking change and removed minor Non breaking change labels May 25, 2026
@jimmycook Jimmy cook (jimmycook) marked this pull request as ready for review May 25, 2026 19:45
Copilot AI review requested due to automatic review settings May 25, 2026 19:45
@skyscanner-backpack-bot
Copy link
Copy Markdown

Visit https://backpack.github.io/storybook-prs/4553 to see this build running in a browser.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

@xiaogliu Vincent Liu (xiaogliu) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DON'T MERGE major Breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants