perf: split reportMetadata into key groups#88613
perf: split reportMetadata into key groups#88613adhorodyski wants to merge 15 commits intoExpensify:mainfrom
Conversation
…mes keys; migrate lastVisitTime Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ng state key Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…sitTimes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44829896a6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
The failing eslint job has nothing to do with the changes, |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b912415f4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
No new product considerations - removing my assignment and unsubscribing. |
|
🚧 @rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
@rlinoz
Explanation of Change
TLDR this PR provides a ~40% improvement to warm opening a report. It goes in pair with the network key dependency removal.
Split ReportMetadata into dedicated keys by concern
reportMetadata_${id}used to bundle four unrelated concerns — business state, loading/pagination flags, and last-visit timestamps. Every loading-flag flip or visit-time update broadcast to everyuseOnyx(reportMetadata_${id})subscriber AND triggered thereportAttributes/todosderivation cascade, even though those derivations only depend onpendingExpenseActionfrom metadata.Split into four dedicated Onyx keys aligned to lifecycle:
reportMetadata_${id}(slimmed)pendingExpenseAction,isOptimisticReport,pendingChatMembers,errorsreportLoadingState_${id}isLoading*/hasLoading*Errorflags,hasOnceLoadedReportActions,isLoadingPrivateNotes,isActionLoadingreportPaginationState_${id}newestFetchedReportActionID,oldestFetchedReportActionIDreportLastVisitTimes(top-level map)reportID → timestampfindLastAccessedReport)Why this works
Warm LHN → report nav used to write
reportMetadata_${id}3 times (OpenReport optimistic → updateLastVisitTime → OpenReport successData). Each write cascaded throughreportAttributes(which transitively readspendingExpenseActionvia a module-levelallReportMetadataglobal) andtodos— neither of which actually changes output on a warm reopen. 15+useOnyx(reportMetadata_${id})subscribers re-rendered on every spurious merge.After the split, those writes land on keys that
reportAttributes/todosdon't subscribe to.reportMetadata_${id}only changes on real business-state events (DEW action, invite, report error), which is exactly when the derivations should run.Measured impact (warm LHN → empty chat, 3 trials, iOS)
ManualOpenReportspan: 452 ms → 267 ms (−40.9 %)reportMetadata_${id}merges: 3 → 0reportAttributesderivation spans: 3 → 0todosderivation spans: 3 → 0Fixed Issues
$ #88595
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
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