Skip to content

[$250] [Due for payment 2026-02-26] Remove Onyx.connect() for the key: ONYXKEYS.COLLECTION.POLICY_TAGS in src/libs/TransactionUtils/index.ts #72719

Closed

Description

@tgolen

This is part of deprecating Onyx.connect. Parent Issue

Details

Be sure to refactor methods using test driven development:

  1. Create a unit test for methods before refactoring
  2. Refactor the methods
  3. Ensure the unit test still runs after refactoring
  4. Reinforce the unit testing with a functional test and a QA test
  5. Once you are done, decrease the number of allowable ESLint warnings here to equal the number of Onyx.connect references remaining in the code
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022027408918706960557
  • Upwork Job ID: 2027408918706960557
  • Last Price Increase: 2026-02-27

Activity

  1. changed the title [-]Remove Onyx.connect() for the key: ONYXKEYS.COLLECTION.POLICY_TAGS in src/libs/TransactionUtils/index.ts[/-] [+]Remove Onyx.connect() for the key: `ONYXKEYS.COLLECTION.POLICY_TAGS` in src/libs/TransactionUtils/index.ts[/+] on Oct 15, 2025
  2. tgolen commented on Oct 24, 2025

    @tgolen
    ContributorAuthor

    This will be worked on eventually

  3. tgolen commented on Nov 3, 2025

    @tgolen
    ContributorAuthor

    This will be worked on eventually

  4. tgolen commented on Nov 13, 2025

    @tgolen
    ContributorAuthor

    This will be worked on eventually

  5. 35 remaining items

  6. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Feb 27, 2026
  7. melvin-bot commented on Feb 27, 2026

    @melvin-bot

    Triggered auto assignment to @JmillsExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  8. tgolen commented on Feb 27, 2026

    @tgolen
    ContributorAuthor

    OK, @JmillsExpensify will help with payment on this one. @dukenv0307 Can you please gather a list of the PRs that were involved with this issue, or was it just the one #81931 ?

  9. MelvinBot commented on Feb 27, 2026

    @MelvinBot
    Contributor

    🔍 Issue Analysis

    Summary: PR #81931 successfully removed the Onyx.connect() subscription for ONYXKEYS.COLLECTION.POLICY_TAGS from src/libs/TransactionUtils/index.ts and replaced it with parameter injection via useOnyx at the component level. The PR was merged and deployed to production (v9.3.22-4). However, one issue requirement was not completed: the ESLint max-warnings count in package.json was not decreased.

    Current State: The core refactoring is complete. Zero Onyx.connect references remain in TransactionUtils/index.ts. The only remaining Onyx.* references (lines 2365 and 2371) are Onyx.METHOD.SET constants used in optimistic/failure OnyxData — these are expected and correct.

    Outstanding Gap: The ESLint max-warnings count in package.json remains at 383 and was not decreased as required by step 5 of the issue.

    Detailed Investigation

    What Changed (PR #81931)

    Removed from TransactionUtils/index.ts:

    • Module-level let allPolicyTags: OnyxCollection<PolicyTagLists> = {} variable
    • Onyx.connect({ key: ONYXKEYS.COLLECTION.POLICY_TAGS, waitForCollectionCallback: true, ... }) subscription
    • getPolicyTagsData(policyID) helper function (which was already marked @deprecated)
    • eslint-disable-next-line @typescript-eslint/no-deprecated suppression comment in the tag comparison branch

    Added/Modified:

    • compareDuplicateTransactionFields() gained a new first parameter policyTags: PolicyTagLists (line 2400)
    • 10 React component callers updated to fetch policyTags via useOnyx() scoped to the specific policyID and pass it as the first argument
    • getReviewNavigationRoute() in TransactionPreviewUtils.ts updated to accept and forward policyTags

    Affected callers:

    • MoneyRequestHeader.tsx
    • TransactionPreview/index.tsx
    • Confirmation.tsx
    • ReviewBillable.tsx, ReviewCategory.tsx, ReviewDescription.tsx
    • ReviewMerchant.tsx, ReviewReimbursable.tsx, ReviewTag.tsx, ReviewTaxCode.tsx

    Tests Added

    tests/unit/TransactionUtilsTest.ts (+257, -29 lines): 8 new test cases covering single-level tags, multi-level tags, disabled tags, empty tags, and edge cases. All 22 existing compareDuplicateTransactionFields tests updated for the new function signature.

    tests/unit/TransactionPreviewUtils.test.ts (+108 lines): 4 new test cases for getReviewNavigationRoute() covering tag review navigation with various policyTags scenarios.

    Issue Requirement Compliance

    Requirement Status
    1. Create unit tests before refactoring ✅ Tests added
    2. Refactor the methods ✅ Onyx.connect removed, parameter injection used
    3. Ensure unit tests pass after refactoring ✅ Tests pass
    4. Reinforce with functional/QA test ✅ PR was QA tested
    5. Decrease ESLint max-warnings count ❌ Not done (still at 383)

    Potential Concern

    A review comment on the PR flagged a potential race condition: since callers pass policyTags ?? {}, if the useOnyx subscription hasn't resolved yet when the user interacts, compareDuplicateTransactionFields could run with empty tags, potentially skipping the tag review step for duplicates that differ by tag. This was categorized as P2.


    Next Steps for Contributor+ team: The ESLint max-warnings count in package.json was not decreased per step 5 of the issue requirements. This should be verified and addressed before closing. Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  10. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Feb 27, 2026
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 27, 2026
  12. melvin-bot commented on Feb 27, 2026

    @melvin-bot

    Current assignees @shubham1206agra and @dukenv0307 are eligible for the External assigner, not assigning anyone new.

  13. changed the title [-][Due for payment 2026-02-26] Remove Onyx.connect() for the key: `ONYXKEYS.COLLECTION.POLICY_TAGS` in src/libs/TransactionUtils/index.ts[/-] [+][$250] [Due for payment 2026-02-26] Remove Onyx.connect() for the key: `ONYXKEYS.COLLECTION.POLICY_TAGS` in src/libs/TransactionUtils/index.ts[/+] on Feb 27, 2026
  14. melvin-bot commented on Feb 27, 2026

    @melvin-bot
  15. dukenv0307 commented on Feb 27, 2026

    @dukenv0307
    Contributor

    We have only 1 PR: #81931

  16. JmillsExpensify commented on Feb 28, 2026

    @JmillsExpensify
    Contributor

    Payment summary:

  17. quinthar commented on Mar 5, 2026

    @quinthar
    Contributor

    Approved $250 to @dukenv0307

  18. garrettmknight commented on Apr 2, 2026

    @garrettmknight
    Contributor

    $250 approved for @shubham1206agra

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 productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsImprovementItem broken or needs improvement.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions