Skip to content

fix: guard ViewHolderCollection against out-of-bounds index on shrink - #2458

Open
ErfanBagheri404 wants to merge 1 commit into
Shopify:mainfrom
ErfanBagheri404:fix/view-holder-out-of-bounds-on-shrink
Open

fix: guard ViewHolderCollection against out-of-bounds index on shrink#2458
ErfanBagheri404 wants to merge 1 commit into
Shopify:mainfrom
ErfanBagheri404:fix/view-holder-out-of-bounds-on-shrink

Conversation

@ErfanBagheri404

Copy link
Copy Markdown

Fixes #2440

The render stack may still hold indices from a previous, larger data set while the layout table has already been resized by a shrink. getLayout(index) then throws at LayoutManager:232. Guard the render path so stale entries drain harmlessly instead of crashing.

Early-return null for entries whose index >= data.length before getLayout/isInLastRow are called.

The render stack may still hold indices from a previous, larger
data set while the layout table has already been resized by a
shrink. getLayout(index) then throws. Skip entries whose index
exceeds data.length so the stale render stack drains harmlessly.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ViewHolderCollection render throws "index out of bounds, not enough layouts" when the render stack outlives a layout-table shrink

1 participant