Skip to content

[Due for payment 2026-06-29] Defer policy expense chat report actions computation off the render path #93788

Description

@mountiny

Problem

useAllPolicyExpenseChatReportActions built a filtered map of policy-expense-chat report actions on every render and was consumed by 5 components, even though the filtered map was only needed inside event-handler callbacks. On heavy accounts this wasted significant work on every render cycle — e.g. KYCWall took ~275ms on a single "Pay" button press (4x CPU throttle).

Solution

Extracted the filtering logic into a pure function getAllPolicyExpenseChatReportActions(allReports, allReportActions) in ReportUtils.ts, migrated all 5 consumers to call it lazily inside the callbacks that need it, and deleted the unused hook. No behavior change — computation moves from the render path to callbacks only.

PR

#93781

Issue OwnerCurrent Issue Owner: @mallenexpensify

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2Task

Type

No type

Fields

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