Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.4.9-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/13176868/test-cases/41237330
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: MacBook Air 26.5 Chrome, iPhone 15 iOS 26.5
App Component: Money Requests
Action Performed:
- Sign in to ND
- Create a collect workspace, enable Taxes
- Create a new tax, set the name to the Foreign and the value to 10%
- Change the 5% tax rate name to Default
- Set the Default rate for Workspace currency default and the Foreign for Foreign currency default in Tax settings
- Start creating a manual expense in the workspace chat
- Enter an amount, ensuring the initial currency is the workspace's default
- Click "Next"
- Scroll down and Verify that the Default rate is applied
- Click the back button
- Change the currency, click "Next"
- Verify that the tax rate is changed to the Foreign
Expected Result:
The Tax rate and the amount are changed according to a new currency
Actual Result:
The default workspace currency tax rate is still displayed on the confirmation page and on the expense details after changing the expense currency
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome Safari
Screenshots/Videos
Bug7182979_1781659649206.foreign_tax_not_updated.mp4
Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7182979
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022067140356654241995
- Upwork Job ID: 2067140356654241995
- Last Price Increase: 2026-08-05
Issue Owner
Current Issue Owner: @mallenexpensifyMetadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
applause-bot commentedon Jun 17, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/69b89277d3d4067f919752e8b1a85a7e7cc390705bca89e608a5ca382060e94c
MelvinBot commentedon Jun 17, 2026
Proposal
What is the root cause of that problem?
When you change the expense currency on the Amount page and tap Next, the confirmation step (
IOURequestStepConfirmation) is a separate route that unmounts when you go Back and remounts when you come forward again. On that fresh mount, the confirmation list incorrectly decides to keep your old tax rate instead of applying the new currency's default.The faulty decision lives in
useTaxAmount.ts:58-59:previousTransactionCurrencycomes fromusePrevious(transaction?.currency). ButusePreviousseeds its ref with the current value on the first render (useRef<T>(value)), so on a fresh mountpreviousTransactionCurrencyequals the new (foreign) currency — not the actual prior currency.That makes the heuristic misfire:
previousDefaultTaxCoderesolves to the foreign default (Foreign/10%) instead of the priorDefault/5%.taxCode = Default(set on the first visit), andhasTaxRateWithMatchingValueistrue.Default !== Foreign→shouldKeepCurrentTaxSelection = true.With
shouldKeepCurrentTaxSelectiontrue,TaxController.tsx:39-41returns early and never callssetMoneyRequestTaxRateValues, so the staleDefault(5%) tax rate remains on the confirmation page and on the expense details.Why the heuristic exists & why it breaks here
shouldKeepCurrentTaxSelectionis meant to preserve a tax rate the user manually picked across a currency change (detected bytaxCodediffering from the previous currency's default). It infers "manual override" by comparing the currenttaxCodeto the previous-currency default. On a genuine in-place currency change this works, becauseusePreviousreturns the real prior currency. But because the confirmation page is a distinct route that remounts on Back→Next,usePreviousreturns the current currency on first render, so the comparison is made against the wrong baseline and an auto-applied default is mistaken for a manual selection.Note that the non-editing create path in
IOURequestStepAmount.tsx:473-479returns early without recomputing tax, so it relies entirely on the confirmation page'sTaxControllerto apply the correct default — which the above bug suppresses.What changes do you think we should make in order to solve the problem?
Make the "keep the user's tax selection" decision robust to a confirmation-list remount, so a fresh mount after a currency change applies the new currency's default rate.
Concretely, in
useTaxAmount.ts: only treat the selection as "manually kept" when there is a real previous currency that differs from the current one. WhenpreviousTransactionCurrencyis unavailable or equals the current currency (i.e. a fresh mount, where no in-session change can be detected), do not setshouldKeepCurrentTaxSelection— letTaxControllerapplydefaultTaxCodefor the current currency.This keeps the intended behavior (preserving a genuinely user-chosen tax rate during an in-place currency change) while fixing the remount case so the foreign default is correctly applied.
What alternative solutions did you explore? (Optional)
shouldKeepCurrentTaxSelectionon it, rather than inferring intent from currency diffs across renders. More robust but larger in scope.IOURequestStepAmount(mirroring the existing track-expense branch atIOURequestStepAmount.tsx:238-246) so it doesn't rely solely on the confirmation page.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/93772)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
ahmdshrif commentedon Jun 17, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the expense confirmation page, changing the transaction's currency does not update the displayed Tax rate. The foreign-currency default tax rate (or the workspace default, when switching back) should be re-applied automatically when the currency changes, but the page keeps showing the previously selected rate.
What is the root cause of that problem?
Tax is recomputed on the confirmation page through
useTaxAmount→TaxController.useTaxAmountcomputes the new default viagetDefaultTaxCode(policy, transaction), which resolves toforeignTaxDefaultvsdefaultExternalIDbased on the (new) currency:App/src/libs/TransactionUtils/index.ts
Line 2145 in 257cd2d
But the re-apply is gated by
shouldKeepCurrentTaxSelection:App/src/components/MoneyRequestConfirmationList/hooks/useTaxAmount.ts
Lines 56 to 59 in 257cd2d
shouldKeepCurrentTaxSelection = hasTaxRateWithMatchingValue(policy, transaction) && transaction?.taxCode !== previousDefaultTaxCode. When the currency changes, the transaction still carries the oldtaxCode/taxValue, sohasTaxRateWithMatchingValueis true; and because the previous default differs from the (still-old)taxCodeonly in the cases this guard was meant to catch, the guard evaluates true andTaxControllerearly-returns before applying the new default:App/src/components/MoneyRequestConfirmationList/TaxController.tsx
Lines 39 to 40 in 257cd2d
So the stale tax code is preserved across the currency change instead of being replaced by the currency-appropriate default.
What changes do you think we should make in order to solve the problem?
The guard should not suppress a re-apply when the currency itself changed. Detect a currency change explicitly and bypass
shouldKeepCurrentTaxSelectionin that case, so the default tax code for the new currency is applied:This forces
TaxControllerto callsetMoneyRequestTaxRateValueswith the newdefaultTaxCode/defaultTaxValuewhen the currency flips between the workspace currency and a foreign currency. Regression check: a genuine manual tax selection (no currency change) must still be preserved — verify switching currency back and forth restores each currency's default, and that manually picking a non-default rate without changing currency is untouched.mukhrr commentedon Jun 17, 2026
Proposal
What is the root cause of that problem?
The create/manual amount flow updates the draft amount and currency, but does not update the draft tax fields for normal workspace expenses.
In
navigateToNextPage(), we save the new amount/currency withsetMoneyRequestAmount():App/src/pages/iou/request/step/IOURequestStepAmount.tsx
Line 236 in 7af4b0e
But
setMoneyRequestAmount()only writesamount,currency,shouldShowOriginalAmount, andisAmountSet; it leavestaxCode,taxAmount, andtaxValueuntouched:App/src/libs/actions/IOU/MoneyRequest.ts
Lines 750 to 754 in 7af4b0e
There is already tax recalculation in this function, but it only runs for
isMovingTransactionFromTrackExpense(action):App/src/pages/iou/request/step/IOURequestStepAmount.tsx
Lines 238 to 246 in 7af4b0e
So the failing path is:
currency, leaving the previoustaxCodein the draft.This is inconsistent with similar existing flows:
App/src/pages/iou/request/step/IOURequestStepAmount.tsx
Lines 489 to 519 in 7af4b0e
App/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx
Lines 182 to 197 in 7af4b0e
App/src/pages/iou/request/step/IOURequestStepTaxRatePage.tsx
Lines 112 to 139 in 7af4b0e
The correct default selector already exists:
getDefaultTaxCode()returnsdefaultExternalIDfor the workspace currency andforeignTaxDefaultfor foreign currency:App/src/libs/TransactionUtils/index.ts
Lines 2129 to 2145 in 7af4b0e
I also checked recent history for
IOURequestStepAmount.tsx. Recent commits touched P2P amount rules, mount-time perf, and track-expense currency plumbing, but not this tax recalculation path:What changes do you think we should make in order to solve the problem?
Update
navigateToNextPage()for non-edit manual workspace expenses so that when taxes are enabled and the selected currency changes, we recalculate and storetaxCode,taxAmount, andtaxValueusing the same currency-default rule as the edit flow.Small diff-style sketch:
To avoid regressions:
taxCode,taxAmount, andtaxValuetogether so draft state stays consistent.QA:
Default; foreign currency default tax =Foreign.Foreignand the recalculated tax amount.What alternative solutions did you explore? (Optional)
We could make confirmation derive the tax from currency at render time, but that only fixes display. The stale
taxCode/taxAmountwould still be submitted. Updating the draft when currency changes fixes both confirmation and final transaction data.David-2002065 commentedon Jun 17, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a manual expense on a tax-enabled workspace, changing the currency before reaching the confirmation page does not re-apply the new currency's default tax rate. The previous (workspace-currency) default stays on the confirmation page and on the created expense, instead of switching to the foreign-currency default.
What is the root cause of that problem?
There are two layers here, and the create flow relies entirely on the second one, which silently misfires:
The create path never persists a currency-appropriate tax code. In
navigateToNextPage, tax is recomputed only for the track-expense move case, so a normal currency change just stores the new currency and leaves the staletaxCode/taxAmounton the draft:App/src/pages/iou/request/step/IOURequestStepAmount.tsx
Lines 232 to 243 in 257cd2d
The confirmation page is supposed to fix this via
TaxController, but itsshouldKeepCurrentTaxSelectionguard wrongly keeps the stale rate. That guard derives the "previous" default fromusePrevious(transaction?.currency):App/src/components/MoneyRequestConfirmationList.tsx
Line 256 in 257cd2d
usePreviousseeds its ref with the current value, so on the confirmation page's fresh mount (it unmounts on Back and remounts on Next)previousTransactionCurrencyequals the new currency. That makespreviousDefaultTaxCoderesolve to the foreign default while the draft still carries the oldtaxCode, sotransaction?.taxCode !== previousDefaultTaxCodeis true and the guard is set:App/src/components/MoneyRequestConfirmationList/hooks/useTaxAmount.ts
Lines 58 to 59 in 257cd2d
With the guard true,
TaxControllerearly-returns and never applies the new default:App/src/components/MoneyRequestConfirmationList/TaxController.tsx
Lines 39 to 41 in 257cd2d
Because the create path doesn't persist the right tax and the confirmation guard suppresses the correction on remount, the stale rate survives onto the submitted expense.
What changes do you think we should make in order to solve the problem?
Fix it at the source so the persisted draft is always correct, independent of the confirmation page's render-timing heuristic. In
navigateToNextPage, recompute the default tax code for the selected currency (reusing the editing flow'sgetDefaultTaxCodelogic) whenever the currency changed, not only for track-expense moves:This guarantees both the confirmation page and the final transaction carry the currency-appropriate tax, and the
if (taxCode)guard keeps non-tax workspaces unaffected.Additionally, we should make
shouldKeepCurrentTaxSelectionrobust to a fresh mount so the confirmation page is not the weak link: only treat the selection as "manually kept" when there is a real prior currency that differs from the current one. Note a fix that merely comparespreviousTransactionCurrency !== currencyis not sufficient on its own — on the remountusePreviousreturns the current currency, so that comparison is false and the guard would still suppress the correction.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
On a tax-enabled workspace with distinct workspace-currency (
defaultExternalID) and foreign-currency (foreignTaxDefault) defaults: start a manual expense in the workspace currency, go to confirmation, go Back, change the currency to a foreign one, press Next, and assert the draft transaction'staxCode/taxAmountequal the foreign default (and switching back restores the workspace default). Also assert a manually-picked non-default rate is preserved when the currency does not change.What alternative solutions did you explore? (Optional)
Persist an explicit "user manually selected tax" flag on the transaction and gate
shouldKeepCurrentTaxSelectionon it rather than inferring intent by comparing currency defaults across renders. More robust, but larger in scope; the create-path persistence above is the lower-risk fix that also corrects the submitted data, not just the displayed rate.yusufdeveloper2903 commentedon Jun 17, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a manual expense (not a track-expense move and not an edit), the tax rate shown on the confirmation page is not updated after the currency is changed. If you open the confirmation page with the workspace's default currency (so the Default tax rate is applied), go back, change the currency to a foreign one, and continue, the confirmation page still shows the workspace-default tax rate instead of the Foreign tax rate that should apply to the new currency.
What is the root cause of that problem?
There are two layers that are supposed to keep the tax rate in sync with the currency, and for the plain "create manual expense" flow neither of them fires:
1. The amount step never recomputes the tax code for the regular create flow.
In
navigateToNextPage(the "Next" button on the amount step), the tax code is only recomputed when moving a transaction from track expense:For a regular manual expense this block is skipped, so
transaction.taxCodekeeps the stale value (the workspace-default tax) even though the currency changed. Note that the edit flow in the same file does handle this correctly (IOURequestStepAmount.tsx:489-492), which is why editing an expense works and only creation is broken.2. The confirmation page's fallback (
TaxController+useTaxAmount) is suppressed by a stalepreviousTransactionCurrency.The confirmation page is supposed to recover from this via
TaxController, which writesdefaultTaxCodeunlessshouldKeepCurrentTaxSelectionis true:previousTransactionCurrencycomes fromusePrevious(transaction?.currency)(MoneyRequestConfirmationList.tsx:255). When the user goes back to the amount step and returns, the confirmation list is unmounted and remounted, sousePreviousre-initializes and returns the new currency, not the old one. The consequence:defaultTaxCode=getDefaultTaxCode(policy, transaction[EUR])→foreignTaxDefault✅ (correct value we want)previousDefaultTaxCode=getDefaultTaxCode(policy, transaction, EUR)→foreignTaxDefaulttransaction.taxCodeis still the staledefaultExternalIDshouldKeepCurrentTaxSelection=true && (defaultExternalID !== foreignTaxDefault)= trueSo
TaxControllerearly-returns (TaxController.tsx:39-41), wrongly treating the stale auto-default as a deliberate user selection, and the tax rate is never updated → bug.What changes do you think we should make in order to solve the problem?
Fix it at the source — recompute the tax code when the currency changes in the create flow's
navigateToNextPage, mirroring the logic already used by the edit flow (IOURequestStepAmount.tsx:489-492) and the track-expense branch.In
src/pages/iou/request/step/IOURequestStepAmount.tsx, insidenavigateToNextPage, generalize the current track-expense-only block:Notes:
getDefaultTaxCode(policy, transaction, selectedCurrency)instead of the inlineoutputCurrencycheck makes it consistent with the rest of the codebase (it also handles distance correctly).selectedCurrency !== previousCurrencypreserves a user's manual tax-rate selection when they go back and change only the amount (currency unchanged → tax not reset).transaction.taxCodenow correctly set to the foreign default before navigation, the confirmation page'sshouldKeepCurrentTaxSelectionevaluates tofalse(foreignTaxDefault === foreignTaxDefault), soTaxControllerno longer fights the change. This fixes the bug end-to-end.All helpers used (
getDefaultTaxCode,getTaxValue,calculateTaxAmount,setMoneyRequestTaxRate,setMoneyRequestTaxAmount,getCurrency) are already imported in this file.What alternative solutions did you explore? (Optional)
Fix the confirmation page instead — make
shouldKeepCurrentTaxSelectionrobust to the remount so it doesn't rely onusePreviousacross mount boundaries (e.g. persist the "user manually selected a tax rate" intent on the draft transaction, or computepreviousDefaultTaxCodefrom the persisted currency rather than the ReactusePreviousvalue). This would also fix it, but it's a larger change to shared confirmation logic and risks regressions in the track-expense/edit flows, whereas the amount-step fix is localized and mirrors patterns already proven in the same file.melvin-bot commentedon Jun 17, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Eskalifer1 (
External)[-]Tax-Tax rate is not updated on the confirmation page after changing currency[/-][+][$250] Tax-Tax rate is not updated on the confirmation page after changing currency[/+]melvin-bot commentedon Jun 17, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022067140356654241995
74 remaining items
Eskalifer1 commentedon Aug 3, 2026
@MelvinBot find offending PR for this issue
MelvinBot commentedon Aug 3, 2026
Offending PR
#85658 — "Improve deleted tax behavior" (author
huult, merged 2026-03-24).That PR introduced the
shouldKeepCurrentTaxSelectionearly-return guard on the confirmation page's default-taxuseEffect. Before it, the effect calledsetMoneyRequestTaxRate(transactionID, defaultTaxCode)unconditionally whenever the default changed — so switching currency re-applied the currency's default tax. #85658 added a guard that misfires on the confirmation page's remount (Back → change currency → Next), leaving the stale default in place. This is exactly the culprit every proposal on this issue converged on.Evidence
The guard was added across two commits in PR #85658:
e99e8eaeadded the early returnif (hasTaxRateWithMatchingValue(policy, transaction)) return;in place of the previous unconditionalsetMoneyRequestTaxRate(...).f64f759brefined it intoshouldKeepCurrentTaxSelection, derivingpreviousTransactionCurrencyfromusePrevious(transaction?.currency).Diff of the change (before → after), from
MoneyRequestConfirmationList.tsx:The logic was later relocated (unchanged) into
useTaxAmount.ts:61-62by the 2026-04-24 view-model refactor, which is where the proposals reference it today.Why it regresses this flow: the confirmation step is a separate route that unmounts on Back and remounts on Next.
usePreviousseeds its ref with the current value on first render, so on the fresh mountpreviousTransactionCurrencyequals the new (foreign) currency.previousDefaultTaxCodethen resolves to the foreign default while the draft still carries the oldDefaulttaxCode, makingshouldKeepCurrentTaxSelectiontrue → the effect returns early → the stale rate stays.#85658was merged 2026-03-24, well before the reported 9.4.9-0, consistent with "reproducible in production".Note #85658 was itself a fix (deleted-tax-rate handling); the guard it added is legitimate for preserving a genuine manual pick — it just isn't robust to the confirmation-list remount. The proposals above address that directly.
Eskalifer1 commentedon Aug 3, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: Improve deleted tax behavior #85658 (comment)
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/668920
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-7e84-a8ab-c9ed-26d66467b854Eskalifer1 commentedon Aug 3, 2026
💰 Price increase request
💵 Proposed amount
$375
🐛 Additional fixes
🧩 Implementation complexity
The tax-on-currency-change logic needed distinct handling for the two different ways a create flow can be entered (workspace chat vs FAB), because each of those paths resolves the workspace policy and the transaction's current tax state differently under the hood. One shared fix didn't hold up across all of them. Each path had to be verified and corrected on its own terms
cc: @lakchote @mallenexpensify
lakchote commentedon Aug 4, 2026
Makes sense to me, cc @mallenexpensify for the message above ^
melvin-bot commentedon Aug 5, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
[-][Due for payment 2026-08-03] [$250] Tax-Tax rate is not updated on the confirmation page after changing currency[/-][+][Due for payment 2026-08-03] [$375] Tax-Tax rate is not updated on the confirmation page after changing currency[/+]melvin-bot commentedon Aug 5, 2026
Upwork job price has been updated to $375
mallenexpensify commentedon Aug 5, 2026
Payment Summary
Contributor+: @Eskalifer1 due $375 via Upwork
Reminder to self to update price to $375 when paying (if it's not already)
@Eskalifer1 can you please accept the job below? Please reply here and tag me once you have.
If you're not sent an offer in Upwork when you're assigned to an issue, please tag me. If an Upwork job exists, please submit a proposal.
https://www.upwork.com/jobs/~022085128431164606639
Eskalifer1 commentedon Aug 6, 2026
Hi @mallenexpensify, i hae accepted, thank you!
mallenexpensify commentedon Aug 7, 2026
@Eskalifer1 paid $375, summary updated above. Thx.