fix(paginator): do not issue the first-page query twice - #1858
Merged
Conversation
`canExecuteQuery` gates on `isLoading`, which lives in state — and on the first-page path that flag is published only after the offline-DB preload is awaited. A second call made in the same tick therefore still reads `false` and proceeds, and with no loaded window both directions resolve to the same first page, so the two calls issue byte-identical requests. A UI does exactly that: an empty or short list sits within the scroll threshold of its top AND its bottom, so the scroll handler calls `toTail` and `toHead` one line apart. Publishing the flag before the await closes the gap. Only the flag — publishing the whole prepared state early would blank a list that offline data is about to fill, which is why that write waits. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
MartinCupela
requested review from
isekovanic,
oliverlaz,
santhoshvai,
szuperaz and
vishalnarkhede
as code owners
September 9, 2026 10:20
oliverlaz
approved these changes
Sep 9, 2026
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.
canExecuteQuerygates onisLoading, which lives in state — and on the first-page path that flag is published only after the offline-DB preload is awaited. A second call made in the same tick therefore still readsfalseand proceeds, and with no loaded window both directions resolve to the same first page, so the two calls issue byte-identical requests.A UI does exactly that: an empty or short list sits within the scroll threshold of its top AND its bottom, so the scroll handler calls
toTailandtoHeadone line apart. Publishing the flag before the await closes the gap. Only the flag — publishing the whole prepared state early would blank a list that offline data is about to fill, which is why that write waits.