Repository navigation
fix(mobile): stop Trending from reshuffling after a cold start - #14698
Open
dylanjeffers wants to merge 2 commits into
Open
dylanjeffers wants to merge 2 commits into
dylanjeffers wants to merge 2 commits into
Conversation
Trending painted the persisted snapshot (up to 24h old), then refetched and swapped in the current order, remounting every tile because keys included the row index. - Hold skeletons while a snapshot that was stale at session start refetches; fresh snapshots still paint instantly. - Key lineup tiles by entity id so a reorder moves tiles. - Only show trailing skeletons for a load-more, not background refetches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
On a cold start, mobile Trending painted the saved snapshot from disk, which can be up to 24 hours old, then refetched and swapped in the current order. Every tile then remounted because lineup keys included the row index, so the list looked like it reloaded into a different UI.
Changes
TrendingLineup: if the restored snapshot was already stale when the session started (older than the 5-minutestaleTime), show skeletons until the mount refetch lands. If that refetch fails, the snapshot is shown. A snapshot that is still fresh paints right away as before. Refetches later in the session (window focus, etc.) never hold, because their data is newer than the session start.useTrending: also returnsisRefetchinganddataUpdatedAt.TrackLineup: tile keys aretrack-<id>/collection-<id>(with a suffix if an entity repeats) instead of including the index, so a reorder moves tiles instead of rebuilding them.TrackLineup: trailing skeletons show only for a load-more the list triggered, not for any background refetch. An empty list that is fetching still shows the initial skeletons.Testing
@tanstack/query-coredirectly against a hydrated snapshot, with the same_optimisticResults: 'optimistic'thatuseBaseQuerysets:fetchNextPage: never holds.🤖 Generated with Claude Code