Skip to content

[Due for payment 2026-08-07] Skip report name recompute for badge-only policy changes in reportAttributes #97095

Description

@mountiny

Problem

Opening the Spend tab for the first time fires OpenSearchPage, whose server response merges the full policy_ collection (5.6k policies on large accounts). getCollectionDelta is a reference-equality scan, so the merge surfaces nearly all policies as "changed" and reportAttributes recomputed computeReportName for ~8245 reports — causing a ~30s main-thread hang. Report names only depend on policy.name / achAccount, not the badge-relevant fields (type, approvalMode, reimbursementChoice, etc.) that hasPolicyRelevantFieldChanged tracks, so this was wasted work.

Solution

Skip computeReportName for reports pulled into the pass solely by badge-only policy changes — they reuse their cached name while badges still recompute. Names are only recomputed when a name-affecting source changes (report/action/nvp/personal-details/transaction/policy-tags updates) or when a policy's name or achAccount actually changed. Also seeds the previousPolicies value-baseline on the startup flush so the first policy trigger has a real baseline to diff against. Reduces Spend tab open time from ~30s to ~5s on throttled CPU.

PR

#97093

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. changed the title [-]Skip report name recompute for badge-only policy changes in reportAttributes[/-] [+][Due for payment 2026-08-07] Skip report name recompute for badge-only policy changes in reportAttributes[/+] on Jul 31, 2026
  2. melvin-bot commented on Jul 31, 2026

    @melvin-bot

    @mountiny @TMisiukiewicz

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.46-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-08-07. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

  3. melvin-bot commented on Jul 31, 2026

    @melvin-bot

    Auto-assign attempt failed, all eligible assignees are OOO.

  4. melvin-bot commented on Aug 3, 2026

    @melvin-bot

    @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

  5. situchan commented on Aug 5, 2026

    @situchan
    Contributor

    Perf issue. No need regression test

  6. melvin-bot commented on Aug 6, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
  7. mallenexpensify commented on Aug 8, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @situchan due $250 via NewDot

  8. laurenreidexpensify commented on Sep 3, 2026

    @laurenreidexpensify
    Contributor

    $250 approved @situchan New Expensify

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 productionDailyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions