Paginate live to-do searches instead of rendering every cached row - #100941
Draft
TMisiukiewicz wants to merge 1 commit into
Draft
Paginate live to-do searches instead of rendering every cached row#100941TMisiukiewicz wants to merge 1 commit into
TMisiukiewicz wants to merge 1 commit into
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Contributor
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
Contributor
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
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.
Explanation of Change
The four to-do searches (Submit, Approve, Pay, Export) render from a live Onyx scan. That scan returns every matching row at once, so an account with a large local cache paints hundreds of rows on the first render.
useSearchSnapshotnow accepts avisibleRowLimitthat truncatesdataafter the sort and the optimistic stabilization, so each page holds the rows at the top of the current order rather than whatever order the scan produced.chartData,filteredDataand the footer count and total still read the full set, so selection, the chart and the totals are unchanged.<Search>derives the cap from the snapshot cursor asmax(50, isLoading ? offset : offset + 50)instead of keeping its own page state. The live early return is gone fromfetchMoreResults, so reaching the end of the list fires a normal Search request with the same offset and totals params as any other search. Sinceoffsetis written to the snapshot optimistically when the request fires, the cap stays on the old offset whileisLoadingis set. The rows hold still and the existing load-more skeleton shows until the response lands.SearchResultsProviderno longer forcesisLoading: falsefor live searches, which is what lets that skeleton know a page is in flight. The full-page skeleton stays suppressed by theshouldUseLiveDatagates already in<Search>anduseSearchLoadingState.Related to #100409, which deletes the live to-do path altogether. This one keeps it and paginates it, so the offline behaviour of the live scan survives.
Fixed Issues
$
PROPOSAL:
Tests
Searchrequest goes out with the next offset, and 50 more rows render once it resolves.Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari