Skip to content

Prevent sparse arrays in snapToOffsets#9329

Merged
mozzius merged 4 commits into
mainfrom
samuel/sparse-arrays
Nov 4, 2025
Merged

Prevent sparse arrays in snapToOffsets#9329
mozzius merged 4 commits into
mainfrom
samuel/sparse-arrays

Conversation

@mozzius
Copy link
Copy Markdown
Member

@mozzius mozzius commented Nov 4, 2025

I accidentally introduced something quite stupid in #7128 - it would lay out all the interest tabs, and then when all the tabs had been all laid out, it would set the offsets to snapToOffsets. However, it would simplely compare lengths. If these rendered out-of-order, this could lead to a sparse array being committed, which would lead to NaNs, which breaks ScrollView internals.

To fix, we need to check that the array isn't sparse. the important one is handleTabLayout(), but for safety I have done a backup check during the render

Should fix https://blueskyweb.sentry.io/issues/6635168999/events/recommended/?project=4508807082278912&query=level%3Afatal&referrer=recommended-event

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 4, 2025

Old size New size Diff
9.44 MB 9.44 MB 34 B (0.00%)

@arcalinea arcalinea temporarily deployed to samuel/sparse-arrays - social-app PR #9329 November 4, 2025 16:33 — with Render Destroyed
@arcalinea arcalinea temporarily deployed to samuel/sparse-arrays - social-app PR #9329 November 4, 2025 17:03 — with Render Destroyed
@mozzius mozzius merged commit 78e20c4 into main Nov 4, 2025
7 checks passed
@mozzius mozzius deleted the samuel/sparse-arrays branch November 4, 2025 20:34
mozzius added a commit that referenced this pull request Nov 5, 2025
* prevent sparse arrays in snapToOffsets

* wait, sparse arrays don't work like that

* more readable check even if it's technically useless

* make the second check actually work
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.

3 participants