Skip to content

[Due for payment 2026-08-21] Spend - Canadian multiple tax export is not shown if an expense was previously deleted. #98523

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.53-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #97853
Email or phone of affected tester (no customers): ibellicotest+2766@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Money Requests

Action Performed:

Prerequisite: Account has at least one workspace with "CAD" as currency.

  1. Open the staging.new.expensify.com website.
  2. Navigate to workspace chat.
  3. Create a manual expense with "CAD" as currency.
  4. Navigate to "Spend" > "Expenses"
  5. Select the just created expense > Click on dropdown menu > "Export"
  6. Note that "Canadian multiple tax export" option is visible.
  7. Select and delete the expense.
  8. Navigate to workspace chat again.
  9. Create a new manual expense.
  10. Return to "Spend" > "Expenses"
  11. Select the just created expense > dropdown menu > "Export"
  12. Note that "Canadian multiple tax export" option is not visible.

Expected Result:

"Canadian multiple tax export" option should be visible for every expense displayed on a workspace with "CAD" as default currency.

Actual Result:

"Canadian multiple tax export" option is not visible on "Spend" for expenses that were created after deleting a previous one.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7232240_1786591004590.CAD3.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7232240

Issue OwnerCurrent Issue Owner: @thelullabyy

Activity

  1. added
    DeployBlockerCash
    Bug
    on Aug 13, 2026
  2. applause-bot commented on Aug 13, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/a6811177bad365b6f2612ddbd5a421fd37fc66cceb0aa5e3706e4873377147e4

  3. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #97853

  4. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    @trjExpensify @NikkiWines @thelullabyy you have been assigned to this deploy blocker because you reviewed the offending PR: #97853

  5. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    @dukenv0307 you have been assigned to this deploy blocker because you authored the offending PR: #97853

  6. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  7. github-actions commented on Aug 13, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  8. MelvinBot commented on Aug 13, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug (fix required in Expensify/App)
    Causing PR: #97853 - "Add Canadian Multiple Tax Export template to New Expensify for workspaces using CAD" by @dukenv0307 (High confidence)
    Related Issues: #97231 (the feature request this PR implements)

    Recommendation: ROLL FORWARD

    The Melvin auto-assignment is correct — this PR introduced both the feature and the buggy visibility gate, so no other staging PR is involved. I recommend a targeted fix rather than a revert: the option is a brand-new, staging-only, repeatedly-requested feature, the export itself still works via other entry points, and the defect is a small, localized logic error in one useMemo. Reverting would pull a wanted feature (and its interwoven SearchQueryUtils/AccountingUtils changes) for a narrow, non-prod edge case.

    Assigned: @dukenv0307 (PR author), @NikkiWines, @thelullabyy, @trjExpensify (approving reviewers) — already assigned by Melvin.
    Labels: No changes. This is a Frontend bug with an App PR involved, so DeployBlockerCash must stay. DeployBlocker is not present. Issue is not reproducible on production (new feature), so removal is not warranted regardless.

    📋 Detailed Analysis

    Evidence

    • The "Canadian multiple tax export" option did not exist before PR Add Canadian Multiple Tax Export template to New Expensify for workspaces using CAD #97853 — it adds CONST.REPORT.EXPORT_OPTIONS.MULTIPLE_TAX_EXPORT, the export.multipleTaxExport copy, and the visibility gating. Bug is 9.4.53-0, reproducible in staging, N/A in prod, matching this PR's ship.
    • The visibility of the option in Spend > Expenses is gated end-to-end by code this PR added, so it is the sole cause.

    Verification

    Gating chain (all added/modified by #97853):

    1. doAllSelectedItemsBelongToCADPolicies — src/hooks/useSearchBulkActions.ts#L578-L594
    2. Passed as includeMultipleTaxExport into getExportTemplates — src/hooks/useSearchBulkActions.ts#L1705-L1714
    3. Which conditionally pushes the template — src/libs/actions/Search.ts#L1818-L1820

    Root Cause

    doAllSelectedItemsBelongToCADPolicies has two branches:

    • Branch A (areAllMatchingItemsSelected === true, lines 579-586) derives CAD-eligibility only from an explicit policyID filter in the query:

      const policyIDFilter = getFilterFromQuery(queryJSON, CONST.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID);
      if (!policyIDFilter.value?.length || policyIDFilter.isNegated) {
          return false; // <-- hides the option whenever no policyID filter is present
      }

      The default "Spend > Expenses" view carries no policyID filter, so this branch returns false and the option is hidden — even though every selected item is CAD.

    • Branch B (areAllMatchingItemsSelected === false, lines 588-593) inspects the actual selected items' policyID (SelectedTransactionInfo.policyID / SelectedReports.policyID, both defined in src/components/Search/types.ts) and correctly returns true for a CAD workspace.

    Why the delete → recreate sequence flips it: the two runs perform the identical action (select one CAD expense), so the only variable is the persisted selection state. The delete step leaves the selection context in the areAllMatchingItemsSelected = true state, and that flag survives a subsequent single-item selection — when the new selection covers every selectable item, SearchSelectionProvider.tsx#L96-L97 preserves the previous areAllMatchingItemsSelected rather than resetting it:

    let areAllMatchingItemsSelected =
        totalSelectableItemsCount && totalSelectableItemsCount !== Object.keys(selectedTransactions).length ? false : prevState.areAllMatchingItemsSelected;

    So in the first run the flag is false → Branch B → option shown; after the delete the flag is stuck true → the new expense evaluates through Branch A → no policyID filter → return false → option hidden. The symptom is therefore a stale select-all flag routing evaluation through the fragile filter-only branch.

    Suggested fix (targeted, low risk)

    Make Branch A resilient to a missing policyID filter instead of returning false. Options:

    • When areAllMatchingItemsSelected is true but there is no policyID filter, fall back to evaluating the actual materialized selection (selectedReports + selectedTransactions, minus excludedTransactions) the same way Branch B does; or
    • Derive the candidate policies from the current search results' items rather than assuming a policyID filter is always present.

    Either keeps the multi-workspace safety (only show when every item is CAD) while fixing the default-view case. A unit test covering "all-matching selected with no policyID filter, all items CAD" should be added.

  9. added
    Reviewing
    on Aug 13, 2026
  10. m-natarajan commented on Aug 13, 2026

    @m-natarajan

    Passed, Chrome / v9.4.53-6 (Android build N/A)

    bandicam.2026-08-13.23-56-18-808.mp4
  11. NikkiWines commented on Aug 13, 2026

    @NikkiWines
    Contributor

    Great, thank you!

  12. removed
    DeployBlockerCash
    on Aug 14, 2026
  13. added
    Daily
    and removed
    Reviewing
    Hourly
    on Aug 14, 2026
  14. changed the title [-]Spend - Canadian multiple tax export is not shown if an expense was previously deleted.[/-] [+][Due for payment 2026-08-21] Spend - Canadian multiple tax export is not shown if an expense was previously deleted.[/+] on Aug 14, 2026
  15. melvin-bot commented on Aug 14, 2026

    @melvin-bot

    @thelullabyy

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

    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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions