Skip to content

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

Draft
Jimmy cook (jimmycook) wants to merge 1 commit into
mainfrom
nojira-remove-initiallyInViewCardIndex
Draft

[NO-JIRA][BpkCardList] Remove initiallyInViewCardIndex prop#4553
Jimmy cook (jimmycook) wants to merge 1 commit 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

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 a72ed2f

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