You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Add BA - Currency list does not display when trying to change WS currency #86457
Please re-state the problem that we are trying to solve in this issue.
On a non-USD workspace, going to Workflows → "Add bank account" → clicking "Update workspace currency" does nothing on the first click. The currency selection RHP only appears on the second click.
What is the root cause of that problem?
This is a race condition between window.history.back() (modal cleanup) and Navigation.navigate() (deferred navigation) on web.
When the confirm modal opens, it pushes a browser history entry with {shouldGoBack: true} (Modal/index.tsx:71). When dismissed, hideModal() (Modal/index.tsx:46-63) does two things:
Calls onModalHide()synchronously — this resolves the confirm promise, which calls confirmCurrencyChangeAndHideModal() (WorkspaceWorkflowsPage.tsx:150-157), which schedules navigation via setNavigationActionToMicrotaskQueue (Promise.then → requestAnimationFrame)
setTimeout(0) fires → history.back() runs, popping the modal's history entry
requestAnimationFrame fires → Navigation.navigate() runs, but history.back() already corrupted the navigation state
On the second click, shouldGoBack is no longer in the history state (consumed by the first history.back()), so hideModal takes the else branch and skips history.back() entirely — navigation succeeds.
What changes do you think we should make in order to solve the problem?
In confirmCurrencyChangeAndHideModal at WorkspaceWorkflowsPage.tsx:150-157, replace Navigation.setNavigationActionToMicrotaskQueue with a direct Navigation.navigate call. This matches the pattern used in WorkspaceInvoiceVBASection.tsx:64-70 which has the same flow but navigates directly without the microtask queue deferral.
By navigating synchronously within the onModalHide callback, Navigation.navigate pushes its history entry before the setTimeout(0) fires history.back(). The setTimeout guard on line 55 checks shouldGoBack — since Navigation.navigate will have replaced the history state by that point, the guard returns early and history.back() is skipped.
What alternative solutions did you explore? (Optional)
Clear shouldGoBack from history state before calling onModalHide() in Modal/index.tsx — this would make the setTimeout guard always skip history.back() when the modal is closed via confirm action. However, this changes shared modal infrastructure and could have broader side effects.
Pass shouldHandleNavigationBack: false from the confirm modal in this specific flow — this would prevent the history entry from being pushed entirely. But this would break the hardware back button behavior while the modal is open.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-]Add BA - Currency list does not display when trying to change WS currency[/-][+][$250] Add BA - Currency list does not display when trying to change WS currency[/+]on Mar 26, 2026
Please re-state the problem that we are trying to solve in this issue.
On a non-USD workspace, clicking "Update workspace currency" in the confirm modal does nothing on the first try. The currency selection RHP only appears after a second attempt.
What is the root cause of that problem?
In confirmCurrencyChangeAndHideModal at WorkspaceWorkflowsPage.tsx#L154-L156, the navigation is wrapped in Navigation.setNavigationActionToMicrotaskQueue, which defers the actual navigate() call to a requestAnimationFrame (~16ms). Meanwhile, the confirm modal's hideModal in Modal/index.tsx#L54-L59 schedules window.history.back() via setTimeout(0) (~4ms) to clean up its guard history entry. Because requestAnimationFrame fires aftersetTimeout(0), history.back() runs first and corrupts the navigation state before navigate() ever executes — the navigation is silently swallowed by the stale history.
The identical flow in WorkspaceInvoiceVBASection.tsx#L69 works correctly because it calls Navigation.navigate()directly without the microtask queue wrapper.
What changes do you think we should make in order to solve the problem?
Remove the unnecessary setNavigationActionToMicrotaskQueue wrapper in confirmCurrencyChangeAndHideModal so the navigation runs synchronously within the promise microtask — before the modal's setTimeout(history.back) fires. This matches the working pattern already used in WorkspaceInvoiceVBASection.tsx:
This is safe because setNavigationActionToMicrotaskQueue exists to ensure Onyx updates flush before navigation, but confirmCurrencyChangeAndHideModal performs no Onyx updates — it only navigates. Removing the wrapper lets the navigate call push its history entry in the microtask, which the setTimeout guard at Modal/index.tsx#L55 then correctly detects (new state lacks shouldGoBack), skipping history.back() entirely.
Please re-state the problem that we are trying to solve in this issue.
When an admin in a non-USD workspace goes to Workflows and taps Add bank account, the confirmation modal for unsupported workspace currency appears. After tapping Update workspace currency, the first click can do nothing, and the user needs to try again before the currency list opens.
Expected: tapping Update workspace currency should navigate to the workspace currency page on the first try.
Actual: the first tap can no-op, and navigation only works on a second try.
What is the root cause of that problem?
The confirm handler depends on policy being available at click time and exits early when policy is temporarily undefined, which creates a race condition during modal confirmation.
The confirmation flow itself is correctly wired to call this handler, so the no-op behavior comes from the early return in that callback rather than from modal wiring.
⚠️@abbasifaizan70 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
This issue has not been updated in over 15 days. @ChavdaSachin eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
MelvinBot commentedon Mar 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On a non-USD workspace, going to Workflows → "Add bank account" → clicking "Update workspace currency" does nothing on the first click. The currency selection RHP only appears on the second click.
What is the root cause of that problem?
This is a race condition between
window.history.back()(modal cleanup) andNavigation.navigate()(deferred navigation) on web.When the confirm modal opens, it pushes a browser history entry with
{shouldGoBack: true}(Modal/index.tsx:71). When dismissed,hideModal()(Modal/index.tsx:46-63) does two things:onModalHide()synchronously — this resolves the confirm promise, which callsconfirmCurrencyChangeAndHideModal()(WorkspaceWorkflowsPage.tsx:150-157), which schedules navigation viasetNavigationActionToMicrotaskQueue(Promise.then → requestAnimationFrame)setTimeout(() => window.history.back(), 0)The execution order ends up being:
requestAnimationFramehistory.back()runs, popping the modal's history entryNavigation.navigate()runs, buthistory.back()already corrupted the navigation stateOn the second click,
shouldGoBackis no longer in the history state (consumed by the firsthistory.back()), sohideModaltakes the else branch and skipshistory.back()entirely — navigation succeeds.What changes do you think we should make in order to solve the problem?
In
confirmCurrencyChangeAndHideModalat WorkspaceWorkflowsPage.tsx:150-157, replaceNavigation.setNavigationActionToMicrotaskQueuewith a directNavigation.navigatecall. This matches the pattern used in WorkspaceInvoiceVBASection.tsx:64-70 which has the same flow but navigates directly without the microtask queue deferral.By navigating synchronously within the
onModalHidecallback,Navigation.navigatepushes its history entry before thesetTimeout(0)fireshistory.back(). ThesetTimeoutguard on line 55 checksshouldGoBack— sinceNavigation.navigatewill have replaced the history state by that point, the guard returns early andhistory.back()is skipped.What alternative solutions did you explore? (Optional)
Clear
shouldGoBackfrom history state before callingonModalHide()in Modal/index.tsx — this would make thesetTimeoutguard always skiphistory.back()when the modal is closed via confirm action. However, this changes shared modal infrastructure and could have broader side effects.Pass
shouldHandleNavigationBack: falsefrom the confirm modal in this specific flow — this would prevent the history entry from being pushed entirely. But this would break the hardware back button behavior while the modal is open.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Mar 26, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ChavdaSachin (
External)[-]Add BA - Currency list does not display when trying to change WS currency[/-][+][$250] Add BA - Currency list does not display when trying to change WS currency[/+]melvin-bot commentedon Mar 26, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022037198654416968655
trasnake87 commentedon Mar 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On a non-USD workspace, clicking "Update workspace currency" in the confirm modal does nothing on the first try. The currency selection RHP only appears after a second attempt.
What is the root cause of that problem?
In
confirmCurrencyChangeAndHideModalat WorkspaceWorkflowsPage.tsx#L154-L156, the navigation is wrapped inNavigation.setNavigationActionToMicrotaskQueue, which defers the actualnavigate()call to arequestAnimationFrame(~16ms). Meanwhile, the confirm modal'shideModalin Modal/index.tsx#L54-L59 scheduleswindow.history.back()viasetTimeout(0)(~4ms) to clean up its guard history entry. BecauserequestAnimationFramefires aftersetTimeout(0),history.back()runs first and corrupts the navigation state beforenavigate()ever executes — the navigation is silently swallowed by the stale history.The identical flow in WorkspaceInvoiceVBASection.tsx#L69 works correctly because it calls
Navigation.navigate()directly without the microtask queue wrapper.What changes do you think we should make in order to solve the problem?
Remove the unnecessary
setNavigationActionToMicrotaskQueuewrapper inconfirmCurrencyChangeAndHideModalso the navigation runs synchronously within the promise microtask — before the modal'ssetTimeout(history.back)fires. This matches the working pattern already used inWorkspaceInvoiceVBASection.tsx:const confirmCurrencyChangeAndHideModal = useCallback(() => { if (!policy) { return; } - Navigation.setNavigationActionToMicrotaskQueue(() => { - Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policy.id, true)); - }); + Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policy.id, true)); }, [policy]);This is safe because
setNavigationActionToMicrotaskQueueexists to ensure Onyx updates flush before navigation, butconfirmCurrencyChangeAndHideModalperforms no Onyx updates — it only navigates. Removing the wrapper lets the navigate call push its history entry in the microtask, which thesetTimeoutguard at Modal/index.tsx#L55 then correctly detects (new state lacksshouldGoBack), skippinghistory.back()entirely.trasnake87 commentedon Mar 26, 2026
Contributor details
Your Expensify account email: trasnake87@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~010f770315ab181656
melvin-bot commentedon Mar 26, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
abbasifaizan70 commentedon Mar 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When an admin in a non-USD workspace goes to
Workflowsand tapsAdd bank account, the confirmation modal for unsupported workspace currency appears. After tappingUpdate workspace currency, the first click can do nothing, and the user needs to try again before the currency list opens.Expected: tapping
Update workspace currencyshould navigate to the workspace currency page on the first try.Actual: the first tap can no-op, and navigation only works on a second try.
What is the root cause of that problem?
The confirm handler depends on
policybeing available at click time and exits early whenpolicyis temporarily undefined, which creates a race condition during modal confirmation.App/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Lines 150 to 157 in 00ddfe5
The confirmation flow itself is correctly wired to call this handler, so the no-op behavior comes from the early return in that callback rather than from modal wiring.
App/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Lines 456 to 466 in 00ddfe5
What changes do you think we should make in order to solve the problem?
Use a stable
policyIDfallback (route.params.policyID) in the confirm handler so navigation does not depend onpolicyhydration timing.App/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Lines 150 to 157 in 00ddfe5
github-actions commentedon Mar 26, 2026
22 remaining items
melvin-bot commentedon Apr 23, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Apr 23, 2026
@ChavdaSachin this issue is now 4 weeks old, please consider:
Thanks!
ChavdaSachin commentedon Apr 28, 2026
Was occupied with other issues, will surely review tomorrow.
ChavdaSachin commentedon Apr 29, 2026
@MelvinBot, let's try the second option you suggested in your alternative solutions. Please implement.
MelvinBot commentedon Apr 29, 2026
🤖 Draft PR created: #89224
Please mark it as "Ready for review" when it is ready for review.
mvtglobally commentedon May 2, 2026
Issue not reproducible during KI retests. (Third week)
melvin-bot commentedon May 22, 2026
This issue has not been updated in over 15 days. @ChavdaSachin eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
m-natarajan commentedon Jun 9, 2026
New issue created for this #93062 and closing this as per this comment