Problem
The flaggedExpenses Onyx derived value runs app-wide for the whole session. It rescans all transactions every time something changes in the report, transaction, violation, or policy collections. These collections change very often.
But this value is only used in one place: the "Review X expenses" row in the For you section on Home. So most of the time we pay for a full rescan that nobody reads.
On heavy accounts this recompute is expensive and it shows up in the ManualSendMessage trace, because the derived value reacts to report and transaction changes that happen when you send a message.
This is part of the work in #77176.
Goal
Stop running this scan app-wide. Move the logic into useReviewFlaggedExpenses, the only consumer, so the scan runs only while Home is mounted. This should be a no-behavior change. The "Review X expenses" row must work exactly as before.
Proposed fix
PR: #94299
Note: this one needs more careful testing than a simple dead-code removal, because the logic is moved, not just deleted.
Related
Issue Owner
Current Issue Owner: @mallenexpensify
Problem
The
flaggedExpensesOnyx derived value runs app-wide for the whole session. It rescans all transactions every time something changes in the report, transaction, violation, or policy collections. These collections change very often.But this value is only used in one place: the "Review X expenses" row in the For you section on Home. So most of the time we pay for a full rescan that nobody reads.
On heavy accounts this recompute is expensive and it shows up in the ManualSendMessage trace, because the derived value reacts to report and transaction changes that happen when you send a message.
This is part of the work in #77176.
Goal
Stop running this scan app-wide. Move the logic into
useReviewFlaggedExpenses, the only consumer, so the scan runs only while Home is mounted. This should be a no-behavior change. The "Review X expenses" row must work exactly as before.Proposed fix
PR: #94299
Note: this one needs more careful testing than a simple dead-code removal, because the logic is moved, not just deleted.
Related
openAndSubmittedReportsByPolicyID): [NoQA] Remove unused OPEN_AND_SUBMITTED_REPORTS_BY_POLICY_ID derived value #94276Issue Owner
Current Issue Owner: @mallenexpensify