Skip to content

Fix viewability callbacks after data updates - #2494

Open
OskarEichler wants to merge 1 commit into
Shopify:mainfrom
OskarEichler:codex/flash-list-viewability-data-update
Open

Fix viewability callbacks after data updates#2494
OskarEichler wants to merge 1 commit into
Shopify:mainfrom
OskarEichler:codex/flash-list-viewability-data-update

Conversation

@OskarEichler

Copy link
Copy Markdown

Description

When the data reference changed but the visible indices stayed the same, the viewability helper retained its index cache and suppressed onViewableItemsChanged. Consumers therefore continued to hold tokens for the previous items until scrolling changed visibility.

Reset the existing viewability cache in the data-update path so the post-commit visibility calculation reports the replacement items. This matches React Native VirtualizedList behavior while leaving normal scroll calculations unchanged.

Reviewers’ hat-rack 🎩

  • Replace visible keyed data without scrolling and verify the callback receives the new item.
  • Confirm ordinary scrolling still avoids duplicate callbacks.

Verification

  • jest --runInBand — 188 tests passed
  • eslint . --ext .ts,.tsx
  • tsc --pretty --noEmit
  • react-doctor . --verbose --diff — 100/100
  • git diff --check

Screenshots or videos (if needed)

Not applicable.

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