Repository navigation
fix(ui): stop list scroll jumps and pagination drift on load-more - #314
Merged
Merged
Conversation
Lists saved the scroll offset before a load-more and jumped back to it after the append, cancelling the user's fling and snapping them back. Refresh captured the offset at request time (a minute early for habits' delayed refresh), and after a refresh the next page was computed from a stale pageIndex, re-fetching and duplicating loaded rows. - Drop scroll save/restore around load-more in all paginated lists. - Capture the refresh offset right before the data swap via PaginationMixin and skip the restore while the user is scrolling. - Page by a DB-row cursor with id dedupe and a load generation that drops stale results (PaginationUtils), so filtered lists such as the Today page habits still reach every row.
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.
Problem
On mobile, scrolling paginated lists (notes, tasks, habits, tags, app usages, app usage rules) stutters and snaps back while more items load.
jumpToto return to it after the append. That cancelled the user's fling and pulled them back to where the load started.pageIndexand re-fetched already-loaded rows. Most lists appended them as duplicates.Changes
Remove scroll save/restore around load-more in all 7 lists.
PaginationMixin.captureScrollOffset/restoreScrollOffset: the refresh offset is captured right before the data swap, and the restore is skipped while the user is scrolling.New
PaginationUtils:hasMoreis based on counts;Lists that filter rows after SQL paging, such as the Today page habits, therefore still reach every row.
The tag-rule and ignore-rule lists replace their data only on refresh.
Tags no longer clear the list on refresh, so the list doesn't drop back to 10 items.
No query, repository, MCP, sync or schema changes.
Tests
pagination_utils_test,pagination_mixin_test,notes_list_test,habits_list_scroll_test.rps formatandrps lint: pass.flutter test: the only failures are pre-existing ones that also fail onmain(desktop_server_sync_service_test.dart,desktop_sync_service_test.dart,integration/mcp_user_actions_test.dart).Known follow-ups (not in this PR)
shrinkWrapand the page size should be measured in profile mode before changing them.