Problem
The reportAttributes derived value has a "first policy load → recompute all reports" escape hatch. On app refresh, ReconnectApp merges ~1k policies while previousPolicies starts empty, forcing needsFullRecompute = true and disabling incremental updates. This re-runs the full per-report attribute pipeline for every report in the account, producing an ~11s JS-thread block on large accounts — typically as a redundant second full pass right after cold start.
Solution
Remove the full-recompute special case for first policy load and reuse the existing scoped path: only reports referencing a policy whose relevant fields actually changed are recomputed. A brand-new policy already counts as "changed" via hasPolicyRelevantFieldChanged(undefined, next), so first load is naturally covered by scoping to reports that reference the loaded policies. Also extend policy-change scoping to invoice reports whose PAY badge depends on the receiver workspace policy. This drops cost from O(all reports) to O(reports-with-a-changed-policy).
PR
#95944
Issue Owner
Current Issue Owner: @mallenexpensify
Problem
The
reportAttributesderived value has a "first policy load → recompute all reports" escape hatch. On app refresh,ReconnectAppmerges ~1k policies whilepreviousPoliciesstarts empty, forcingneedsFullRecompute = trueand disabling incremental updates. This re-runs the full per-report attribute pipeline for every report in the account, producing an ~11s JS-thread block on large accounts — typically as a redundant second full pass right after cold start.Solution
Remove the full-recompute special case for first policy load and reuse the existing scoped path: only reports referencing a policy whose relevant fields actually changed are recomputed. A brand-new policy already counts as "changed" via
hasPolicyRelevantFieldChanged(undefined, next), so first load is naturally covered by scoping to reports that reference the loaded policies. Also extend policy-change scoping to invoice reports whose PAY badge depends on the receiver workspace policy. This drops cost from O(all reports) to O(reports-with-a-changed-policy).PR
#95944
Issue Owner
Current Issue Owner: @mallenexpensify