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.
Problem
ReportActionItemis rendered once per report action in a FlatList. It contains severaluseOnyxcalls 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_LISTalone creates 50 separate subscriptions that all return the same data.Proposed Solution
Move all common (non-instance-specific) Onyx subscriptions from
ReportActionItemto the parent list components (ReportActionsListandMoneyRequestReportActionsList), and pass the data as props through the component chain.Subscriptions to uplift (8 total):
ONYXKEYS.NVP_INTRO_SELECTEDintroSelectedONYXKEYS.COLLECTION.TRANSACTION_DRAFTallTransactionDraftsONYXKEYS.CARD_LISTcardListONYXKEYS.BANK_ACCOUNT_LISTbankAccountListONYXKEYS.PERSONAL_POLICY_IDpersonalPolicyIDONYXKEYS.COLLECTION.REPORT_METADATA{reportID}reportMetadataONYXKEYS.COLLECTION.POLICY_TAGS{policyIDForTags}policyTagsusePolicyForMovingExpenses()hook (3 internal subscriptions)policyForMovingExpensesIDInstance-specific subscriptions that remain in ReportActionItem:
useOriginalReportID(depends on each action)useReportIsArchived(depends on originalReportID)useReportTransactions(per-action iouReport)linkedTransactionRouteError(per-action transactionID)Impact
usePolicyForMovingExpenseshook)allReports,policies,personalDetails, etc.