Skip to content

Uplift common Onyx subscriptions from ReportActionItem to parent list components #83204

@mountiny

Description

@mountiny

Problem

ReportActionItem is rendered once per report action in a FlatList. It contains several useOnyx calls that subscribe to the same global Onyx key for every instance. For a list of N report actions, each of these common keys gets N identical subscriptions instead of 1.

For example, with 50 visible report actions, ONYXKEYS.CARD_LIST alone creates 50 separate subscriptions that all return the same data.

Proposed Solution

Move all common (non-instance-specific) Onyx subscriptions from ReportActionItem to the parent list components (ReportActionsList and MoneyRequestReportActionsList), and pass the data as props through the component chain.

Subscriptions to uplift (8 total):

Key Variable
ONYXKEYS.NVP_INTRO_SELECTED introSelected
ONYXKEYS.COLLECTION.TRANSACTION_DRAFT allTransactionDrafts
ONYXKEYS.CARD_LIST cardList
ONYXKEYS.BANK_ACCOUNT_LIST bankAccountList
ONYXKEYS.PERSONAL_POLICY_ID personalPolicyID
ONYXKEYS.COLLECTION.REPORT_METADATA{reportID} reportMetadata
ONYXKEYS.COLLECTION.POLICY_TAGS{policyIDForTags} policyTags
usePolicyForMovingExpenses() hook (3 internal subscriptions) policyForMovingExpensesID

Instance-specific subscriptions that remain in ReportActionItem:

  • useOriginalReportID (depends on each action)
  • useReportIsArchived (depends on originalReportID)
  • useReportTransactions (per-action iouReport)
  • linkedTransactionRouteError (per-action transactionID)

Impact

  • Eliminates ~8 redundant Onyx subscriptions per list item (plus 3 from the usePolicyForMovingExpenses hook)
  • For a typical list of 50 report actions, this removes ~400-550 redundant subscription registrations
  • Follows the existing pattern already used for allReports, policies, personalDetails, etc.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions