Skip to content

[Due for payment 2026-06-30] [Perf] Avoid building archived reports ID set in useDeleteTransactions #94169

Description

@mountiny

Problem

useDeleteTransactions called useArchivedReportsIDSet(), which runs buildArchivedReportsIDSet and iterates over every report's name-value-pairs entry to build a Set on each render. For large accounts (~100k reports) this is a full O(n) sweep on every render, even though the set was only used for a single lookup — checking whether the chat IOU report is archived.

Solution

Removed useArchivedReportsIDSet and replaced the upfront set build with a direct isArchivedReport call on the single NVP entry for the chat IOU report: isArchivedReport(allReportNameValuePairs?.[REPORT_NAME_VALUE_PAIRS + chatIOUReportID]). The hook already subscribes to ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS, so no new Onyx subscription is added and behavior is identical.

PR

#94154

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 productionDailyKSv2Task

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions