Repository navigation
Conversation
38 tasks
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 builds on the
useOnyxStateOnyx bump in Expensify#104690 (Onyx Expensify#862).DERIVED.REPORT_ATTRIBUTESholds the name, the status fields (RBR/GBR, action badge, errors, one-transaction thread ID) andisEmptyof every report. OnyxDerived recomputes it after every relevant write, in a second render wave, and writes the whole map to Onyx and to disk on each flush.This removes the derived value completely. The per-report compute moves, unchanged, into pure functions (
ReportAttributesComputeUtils) and an incremental computer (computeReportAttributes). A module-level cache (ReportAttributesCache) diffs the dependency references and recomputes only the changed reports, so every consumer shares one compute. Readers use new hooks built onuseOnyxState:useAllReportAttributes,useReportAttributesEntry,useReportStatus,useReportName,useReportNamesanduseIsEmptyReport. They read the live store, as the derived value did, not the Search snapshot. When nothing changed, the cache returns the previous object, and unchanged entries keep their reference.Without persistence, the first compute after boot cost +7.5% on web cold startup for a large account. An idle-saved snapshot (
reportAttributesSnapshot, debounced, flushed on background) seeds the first compute when the account and locale match, which brings startup back to parity. A migration clears the old storedreportAttributesvalue.UnreadIndicatorUpdaterno longer subscribes to the key.Two behaviour fixes come with it: moved and unreported thread names no longer depend on which report was computed first, and entries for deleted reports no longer survive a locale change.
Measurements against Expensify#104690, both legs on the same Onyx build, large account (4,057 reports), web at 4x CPU throttle:
Follow-ups: rename the
ReportAttributesDerivedValuetype and thereportAttributesDerived*parameters, narrow the libs to agetReportNameaccessor, and lazy names (Expensify#3260).Fixed Issues
$ https://github.com/callstack-internal/expensify-issues/issues/3085
PROPOSAL:
Tests
main.Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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