[NO-JIRA][BpkCardList] Remove initiallyInViewCardIndex prop#4553
Draft
Jimmy cook (jimmycook) wants to merge 1 commit into
Draft
[NO-JIRA][BpkCardList] Remove initiallyInViewCardIndex prop#4553Jimmy cook (jimmycook) wants to merge 1 commit into
Jimmy cook (jimmycook) wants to merge 1 commit into
Conversation
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>
|
Visit https://backpack.github.io/storybook-prs/4553 to see this build running in a browser. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
initiallyInViewCardIndexfromBpkCardListand the row/rail container, plus the supportinginitialPageIndexplumbing throughBpkCardListCarouselandusePageScrollSync.bpk-component-card-list).Why
The prop ran
scrollIntoViewfrom a mount-timeuseEffect. When the carousel mounts inside a parent that hasn't laid out yet (e.g.AnimateHeightatdisplay: 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
AnimateHeightanimation completes (IRN-6568, web-platform commit29b3db2687). 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 passingtsc --noEmitclean forpackages/backpack-webRowToRail/RowToStackexamples🤖 Generated with Claude Code