perf: remove policies live merge from Search getSections (S3 #2590)#52
Closed
BartekObudzinski wants to merge 1 commit into
Closed
perf: remove policies live merge from Search getSections (S3 #2590)#52BartekObudzinski wants to merge 1 commit into
BartekObudzinski wants to merge 1 commit into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Author
|
not this fork |
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
This is the first PR of Slice 3 ("live-merge mop-up") of the Search screen decomposition.
getSectionsperforms a parallel double-merge of live Onyx data that the row layer already self-hydrates, which is the cascade source for Search jank. S3 removes the remaining live-Onyx merge inputs fromgetSections, one cluster per PR (highest fan-out first). This PR removespolicies(the highest-fan-out input).policieslive-Onyx input fromgetSections/getReportSections(signatures, the call site, and both param type defs) inSearchUIUtils.ts.getReportSectionsnow resolves the report's policy from the search snapshot viagetPolicyFromKey(data, reportItem).useOnyx(ONYXKEYS.COLLECTION.POLICY)subscription, thegetSectionsargument, and theuseMemodependency inSearch/index.tsx.ExpenseReportListItemnow recomputes the violations badge (hasVisibleViolations, newly exported, over live policy + the report's live violations/transactions fromuseTransactionsAndViolationsForReport) and the report avatar (getSearchReportAvatarPropsover live policy +useReportIsArchived+ snapshot personal-details) from its own live Onyx data, replacing the pre-joined values. This keeps the displayed badge/avatar fresh on live policy edits, which the removed screen-level merge previously handled.Verification done:
ExpenseReportListItem.tsxcompiles;Search/index.tsxretains its pre-existing (unrelated) non-compilation and its load-bearing manual memoization.tests/unit/Search/SearchUIUtilsTest.ts346/346,tests/unit/hooks/useSearchSections.test.ts+tests/unit/TransactionGroupListItemTest.tsx16/16.Fixed Issues
$ https://github.com/callstack-internal/expensify-issues/issues/2590
PROPOSAL:
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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