Skip to content

[Due for payment 2026-08-29] Perf: select only the target admin policy ID in ProductMarketingWindowManager #99064

Closed

Description

@mountiny

Problem

ProductMarketingWindowManager subscribed to the whole policy_ collection with a selector returning Policy[] — every active admin policy — so useOnyx deep-compared all of those policy objects on every policy-collection update, measured at 37ms per compare on a large account. The component never used the array as an array: it only ever reduced it to a single target policy via find(id === activePolicyID) ?? at(0). On an account with roughly 5k policies this cost about 90ms on Web when opening reports from Search.

Solution

Narrow the collection selector to return just the target policy's ID, and get the policy object itself from a separate single-member useOnyx subscription with no selector, so that one compares by reference instead of deep-comparing. variant and shouldPrefetchTargetPolicyConnections now branch on targetAdminPolicyID rather than the policy object, which as a side benefit closes a one-render window where the object could lag the ID and briefly flip the admin variant to the member variant. Target-policy selection logic is unchanged, as is everything handed to usePolicyConnectionsPrefetch and getCtaRoute; the loading gate swaps activeAdminPoliciesMetadata for targetAdminPolicyIDMetadata.

Notes

This PR is currently a draft. The change is small and contained — +13/−7 in the single file src/components/ProductMarketingWindow/ProductMarketingWindowManager.tsx.

PR

#99063

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. melvin-bot commented on Aug 22, 2026

    @melvin-bot

    @mountiny @TMisiukiewicz

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.58-4 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-29. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]

  2. changed the title [-]Perf: select only the target admin policy ID in ProductMarketingWindowManager[/-] [+][Due for payment 2026-08-29] Perf: select only the target admin policy ID in ProductMarketingWindowManager[/+] on Aug 22, 2026
  3. melvin-bot commented on Aug 25, 2026

    @melvin-bot

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

  4. melvin-bot commented on Aug 27, 2026

    @melvin-bot

    @TMisiukiewicz Huh... This is 4 days overdue. Who can take care of this?

  5. melvin-bot commented on Aug 30, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  6. melvin-bot commented on Aug 30, 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
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  7. mallenexpensify commented on Sep 1, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @abzokhattab due $250 via NewDot

  8. quinthar commented on Sep 25, 2026

    @quinthar
    Contributor

    Approved $250 to @abzokhattab

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions