Skip to content

[Due for payment 2026-02-12] Reduce Report Load Time by Eliminating Redundant Card Merging #79670

Description

@mountiny

Coming from Slack

Background:

Currently, personal Expensify cards are stored under ONYXKEYS.CARD_LIST, while workspace-issued cards are stored under ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST. Multiple components independently subscribe to both stores and locally merge the two datasets using mergeCardListWithWorkspaceFeeds, often applying slightly different filtering logic. These components mount frequently, while the underlying card data changes relatively infrequently.

Problem:

When users open reports that contain many personal and workspace cards, then report views take noticeably longer to load, degrading the perceived performance of core reporting workflows.

Solution:

Introduce a derived Onyx value, ONYXKEYS.DERIVED.NON_PERSONAL_AND_WORKSPACE_CARD_LIST, which depends on CARD_LIST and WORKSPACE_CARDS_LIST. This derived value filters out personal cards and merges both sources once within the Onyx engine, recomputing only when one of the underlying keys changes. Components subscribe to the derived value instead of performing local merges, eliminating redundant per-mount computations.

Results:
On heavy account there is +40k cards in workspace list.

  • Open report from Reports Tab, Expenses section. Time reduced from 750ms to 560 ms (25%)
    • Number or mergeCardListWithWorkspaceFeeds calls reduced from 29 to 0
  • Restart app (on Reports Tab, Expenses section) Time reduced from 3850 ms to 3630 ms (5,7%)
    • Number or mergeCardListWithWorkspaceFeeds calls reduced from 49 to 9.
  • Open report from Reports Tab, Reports section. Time reduced from 775ms to 600 ms (22%)
  • Time spent on useCardFeedsForDisplay reduced from 260ms to 0.1ms (stable derived reference, openReport action)

Even with a few cards, it provides a more stable reference, which should result in fewer rerenders for other components.
Draft PR: #79347
Part of #77173 effort

Issue OwnerCurrent Issue Owner: @stephanieelliott
Issue OwnerCurrent Issue Owner: @LukasMod

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 productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions