Skip to content

[Due for payment 2026-07-13] [Performance] flaggedExpenses derived value runs app-wide but is only used on Home #94317

Description

@cristipaval

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 OwnerCurrent Issue Owner: @mallenexpensify

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions