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
[Due for payment 2026-07-17] [$250] "Let's go" migrate welcome button redirects to Inbox instead of Spend page after completing the demo #95228
Version Number: Reproducible in staging?: Needs Reproduction Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@flaviadefaria Slack conversation (hyperlinked to channel name): #Migrate
Action Performed:
Log in as a Migrated user
Click on the 2-minute demo on the modal
Watch the demo until completion
Navigate back to New Expensify
Click the "Let's go" button
Observe the page the user is redirected to
Expected Result:
After clicking "Let's go", the user should be redirected to the Spend page.
Actual Result:
The user is redirected to the Inbox page instead of the Spend page.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
The "Let's go!" button in the MigratedUserWelcomeModal never navigates to the Spend page — it only pops the modal, revealing whatever screen was underneath (the Inbox).
The intended navigation to Spend lives only in the handleDismiss handler, which is wired to react-navigation's beforeRemove event via useBeforeRemove. But the confirm button doesn't call it directly — the modal passes onClose={handleClose} (Navigation.goBack()) and no onConfirm prop to FeatureTrainingContent. Since shouldCloseOnConfirm defaults to true, clicking "Let's go!" collapses to just Navigation.goBack().
The handleDismiss → Navigation.navigate(SEARCH_ROOT) call then fires during the in-flight GO_BACK removal, where it is dropped/overridden by the pop that is completing. The net result is the goBack target (Inbox), not Spend. useBeforeRemove even documents this limitation and recommends replacing it with usePreventRemove after the react-navigation 7.x upgrade.
Evidence (SHA 351f01d)
Modal passes onClose (goBack) but no onConfirm; the SEARCH_ROOT navigation is only inside handleDismiss/useBeforeRemove: MigratedUserWelcomeModal.tsx:54-93
"Spend" = the Search tab = ROUTES.SEARCH_ROOT with a canned query, i.e. the same route handleDismiss targets — so the intended destination is correct, only the navigation is lost: SearchTabButton.tsx:37-108, common.spend: 'Spend' in en.ts
Data flow:Let's go! → handleConfirm → (no onConfirm) → onClose → Navigation.goBack() pops the modal and emits beforeRemove → handleDismiss fires navigate(SEARCH_ROOT) mid-removal → superseded by the pop → user lands on Inbox.
What changes do you think we should make in order to solve the problem?
Make the confirm ("Let's go!") path navigate to the Spend page explicitly instead of relying on goBack + the beforeRemove handler:
Pass an onConfirm to FeatureTrainingContent that runs the same logic as handleDismiss (dismissProductTraining(...) + Navigation.navigate(ROUTES.SEARCH_ROOT...)), and set shouldCloseOnConfirm={false} so a subsequent goBack doesn't clobber the navigation.
Alternatively (and more robustly for all dismissal paths — confirm, backdrop press, swipe), replace handleClose's Navigation.goBack() with a direct Navigation.navigate(ROUTES.SEARCH_ROOT...), so every exit deterministically lands on Spend without depending on beforeRemove timing.
What alternative solutions did you explore? (Optional)
Keeping the beforeRemove/goBack approach but reordering the calls is fragile because the navigate is issued during the removal dispatch. Long term, migrating off useBeforeRemove to usePreventRemove (per the hook's own note) would remove this class of timing bug.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/95228) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
After a migrated user completes the 2-minute demo, clicking “Let's go” in the welcome modal opens Inbox instead of Spend.
What is the root cause of that problem?
In src/components/MigratedUserWelcomeModal.tsx, the confirmation handler dismisses the modal and relies on the route underneath it. The demo navigation changes that underlying state, so returning from the demo leaves Inbox as the destination rather than Spend.
What changes do you think we should make in order to solve the problem?
Update the welcome modal’s confirmation handler to explicitly navigate to the existing Spend route after dismissing the modal. This makes “Let's go” deterministic regardless of whether the user opened and completed the test-drive flow first. Add a regression test covering confirmation after returning from the demo.
What alternative solutions did you explore? (Optional)
We could restore the pre-demo route when leaving the test drive, but that couples the demo flow to this modal. Explicitly routing the modal’s CTA to its intended destination is smaller and more reliable.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-02 19:05:10 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
A migrated user finishes the welcome modal (watches the 2-minute demo or just hits "Let's go") and expects to land on the Spend page. Instead they end up on Inbox. The button that's supposed to drop them into their expenses drops them somewhere else.
What is the root cause of that problem?
This is a regression from cba9db2bff1 (2026-06-17), the commit that migrated MigratedUserWelcomeModal to CenteredModalLayout. Before that change the modal was a self-managed FeatureTrainingModal, and its onClose ran dismissProductTraining() and then Navigation.navigate(SEARCH_ROOT) — so closing always resolved to Spend.
After the migration the modal is a navigator screen, so closing it goes through Navigation.goBack(), which just reveals whatever screen is underneath the overlay — Inbox. The "go to Spend" navigation got moved into useBeforeRemove(handleDismiss) in src/components/MigratedUserWelcomeModal.tsx (lines 54-60). When you confirm, FeatureTrainingContent.handleConfirm runs (shouldCloseOnConfirm defaults to true), which calls onClose → handleClose → goBack(). The Navigation.navigate(SEARCH_ROOT) that handleDismiss dispatches from inside beforeRemove races the pop that's already in flight and loses, so Inbox wins.
You can see the intended contract in the sibling modals. AutoSubmitModal, ChangePolicyEducationalModal, and HoldOrRejectEducationalModal all use useBeforeRemove for NVP cleanup only and do their real navigation in onConfirm. MigratedUserWelcomeModal is the only one that puts a Navigation.navigate to a different route inside beforeRemove, and that's the bug.
One thing worth calling out: this isn't only the button. Backdrop press and swipe-to-dismiss regressed the same way. The old onClose sent all of those to Spend; now they all go through goBack() to Inbox with only the NVP cleanup running. The fix should cover the confirm path and the dismiss path together, not just "Let's go".
What changes do you think we should make in order to solve the problem?
Split the two concerns so they match the pattern the sibling modals already follow. Keep handleDismiss for cleanup only, and move the navigation into an onConfirm handler with shouldCloseOnConfirm={false} so we don't fire a competing goBack:
consthandleDismiss=()=>dismissProductTraining(CONST.MIGRATED_USER_WELCOME_MODAL);useBeforeRemove(handleDismiss);consthandleConfirm=()=>Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: buildCannedSearchQuery({type: CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT})}));// on <FeatureTrainingContent>: onConfirm={handleConfirm} shouldCloseOnConfirm={false}
Navigating to SEARCH_ROOT tears down the overlay and lands on Spend in one action, which is exactly the pre-regression behavior. The same handleConfirm should back the backdrop/swipe dismiss so those paths land on Spend too.
One thing to validate in a running web build: MigratedUserWelcomeModalGuard.shouldBlockWhileModalActive() blocks non-DISMISS_MODAL/GO_BACK actions while the modal is active and training hasn't been dismissed yet (Onyx cache is async). In the reported demo path dismissProductTraining has already run via "Try 2-min demo", so the guard won't block the navigate. The no-demo path needs the dismiss to land before the navigate, so I'd confirm ordering on web before finalizing.
There's no test asserting where confirm/close lands — only MigratedUserWelcomeModalGuard.test.ts exists, and it covers the guard logic. I'd add a test that confirms both the button and the dismiss paths route to Spend so this doesn't silently regress again.
What alternative solutions did you explore? (Optional)
Keep the navigation in beforeRemove but chain it after the pop settles (e.g. defer the navigate). That works around the race instead of fixing the ownership problem, and it leaves MigratedUserWelcomeModal as the odd one out versus its siblings. Doing the navigation in onConfirm is cleaner and matches the established pattern. I also checked whether this was the TestDriveDemo navigator or getTestDriveURL, but the code rules both out — getTestDriveURL only picks which video plays, and TestDriveDemo is a separate feature.
Please re-state the problem that we are trying to solve in this issue.
A migrated user opens the "Welcome to New Expensify!" modal, tries the 2-minute demo, comes back, and clicks "Let's go!". They should land on the expense/Spend Search page, but they land on Inbox instead.
What is the root cause of that problem?
PR #93815 (Refactor MigratedUserWelcome modal to CenteredModalLayout, merged 2026-06-22) moved the post-dismiss "navigate to Spend" out of the modal's explicit close handler into a beforeRemove listener. A navigation dispatched from inside beforeRemove runs in the middle of the GO_BACK dispatch that is removing the modal, and never survives it. Chain:
). Before #93815, this navigate ran in onClose after the modal was fully closed; now it runs inside the removal event.
react-navigation computes the popped state for GO_BACK before emitting beforeRemove, and commits that state after the listeners return (useOnAction: shouldPreventRemove emission precedes setState(result)). So the Navigation.navigate(SEARCH_ROOT…) dispatched by the listener pushes the Search route, and the outer GO_BACK — whose new state was computed from the pre-navigate state — immediately overwrites it. Last write wins; the Search push is silently discarded. (The repo already flags this hook as limited:
), and shouldBlockWhileModalActive blocks any non-GO_BACK/DISMISS action while the modal navigator is still state.routes.at(-1) and the dismissal NVP hasn't landed (
) — the guard allows the navigate, but the commit-ordering clobber in step 3 still discards it.
The GO_BACK therefore lands on whatever sits under the modal: the base path captured when the guard pushed it — Navigation.getActiveRoute() || ROUTES.HOME, i.e. Inbox for a freshly migrated user (
Structural cause: a navigation side effect was attached to the removal event of the screen being removed, so it always races the removal that triggers it. Both dismissal paths (with and without the demo) are affected; the FullStory session captured the demo one.
What changes do you think we should make in order to solve the problem?
In MigratedUserWelcomeModal.tsx, keep beforeRemove only as the dismissal backstop and dispatch the Spend navigation after the pop commits, using the existing afterTransition option of Navigation.goBack (
) both call handleClose. By afterTransition time the modal is no longer top-of-stack, so neither the guard block nor the state clobber applies, on either NVP timing. Regression safety: onHelp, the guard, and dismissal semantics are unchanged — the only behavior change is that the navigate is dispatched after the pop instead of during it. (Destination stays the canned expense-report Search route the current code targets; if product wants the literal Spend tab, it's a one-word query change at the same site.)
Why the obvious spot fix fails: calling Navigation.navigate(...) synchronously right after Navigation.goBack() (or leaving it inside handleDismiss) still loses — the GO_BACK's popped state is computed before the listener/next line runs and committed after, overwriting the Search push; and whenever the async dismissal NVP hasn't propagated, shouldBlockWhileModalActive swallows the NAVIGATE outright while the modal navigator is still on top.
What alternative solutions did you explore? (Optional)
Restore the pre-#93815 shape (navigate directly in onClose, no goBack) — the old FeatureTrainingModal closed itself via its hide-animation callback; with route-backed CenteredModalLayout the modal route must be popped explicitly, and navigating without popping leaves the modal route stacked under Search.
Relax shouldBlockWhileModalActive to allow NAVIGATE during dismissal — touches shared guard logic, risks reintroducing the tab-switch race the guard exists to prevent, and doesn't fix the setState clobber (the demo path proves blocking isn't the only defeat).
Navigate only from onConfirm — misses the backdrop-press dismissal, which also runs handleClose and would still land on Inbox.
Please re-state the problem that we are trying to solve in this issue.
On Web (Chrome, Safari/macOS), after a migrated user watches the 2-minute demo and clicks the "Let's go" button in MigratedUserWelcomeModal, they land on the Inbox page instead of the Spend (Search/Reports) page. Clicking "Let's go" should navigate to the Spend page.
What is the root cause of that problem?
In src/components/MigratedUserWelcomeModal.tsx (lines 81–99), MigratedUserWelcomeModal renders FeatureTrainingContent without passing an onConfirm prop — only onClose={handleClose} is wired, where handleClose = () => Navigation.goBack() (line 63).
In src/components/FeatureTrainingContent.tsx (lines 253–258), handleConfirm is:
consthandleConfirm=()=>{onConfirm?.(willShowAgain);// no-op — no onConfirm passedif(shouldCloseOnConfirm){// true by defaultonClose?.();// calls Navigation.goBack() → Inbox}};
So pressing "Let's go" unconditionally calls Navigation.goBack(), which pops the modal and reveals Inbox.
The useBeforeRemove(handleDismiss) at line 60 registers a beforeRemove listener that calls Navigation.navigate(ROUTES.SEARCH_ROOT…). However, handleDismiss never calls e.preventDefault() on the navigation event, so the original goBack() still proceeds. On web, the goBack() wins this race and the subsequent navigate(SEARCH_ROOT) is effectively discarded — the user sees Inbox.
What changes do you think we should make in order to solve the problem?
All changes are in src/components/MigratedUserWelcomeModal.tsx:
Add an explicit handleConfirm callback (around line 54, alongside the existing handleDismiss):
This mirrors what handleDismiss already does. Navigation.navigate(SEARCH_ROOT) navigates the root navigator to the Spend page, which inherently closes the modal — no separate goBack() is needed.
Pass onConfirm and shouldCloseOnConfirm={false} to <FeatureTrainingContent> (around line 86–99):
<FeatureTrainingContent{...illustrationProps}...onConfirm={handleConfirm}shouldCloseOnConfirm={false}{/* prevent goBack() firing after onConfirm */}onClose={handleClose}...>
shouldCloseOnConfirm={false} is critical: without it, FeatureTrainingContent.handleConfirm calls both onConfirm (which navigates to SEARCH_ROOT) and then onClose (which calls Navigation.goBack()), risking popping the user off the just-navigated Spend page or double-firing handleDismiss via beforeRemove.
Keep useBeforeRemove(handleDismiss) unchanged for the backdrop-press / hardware-back dismissal path — when the user closes the modal without pressing "Let's go", this hook still navigates them to the Spend page.
What alternative solutions did you explore? (Optional)
Rely solely on useBeforeRemove(handleDismiss): The existing handleDismiss already calls navigate(SEARCH_ROOT) in beforeRemove. The problem is that without e.preventDefault(), the goBack event proceeds alongside the navigate call. On web, the goBack() wins the race, so this mechanism is unreliable for the "Let's go" button path.
Call e.preventDefault() in handleDismiss: Would intercept ALL removal events (including back-button / backdrop), causing the modal to be un-closeable unless you manually navigate. Worse, useBeforeRemove exposes the raw event listener and handleDismiss doesn't currently receive the event object — requires refactoring the hook.
Passing shouldCloseOnConfirm={false} alone (without onConfirm): Does nothing on its own — onConfirm is still a no-op, user still ends up on Inbox via the residual goBack() on the close path.
Note: This is not a duplicate — it closes a path every prior proposal (including the anchor-based ones) leaves broken. The proposals so far fall into two families. Family A re-dispatches a navigation at close time (onConfirm + shouldCloseOnConfirm={false}, direct navigate() in handleClose, goBack + afterTransition, goBack(backToRoute)). Family B re-anchors the modal over Spend in MigratedUserWelcomeModalGuard so a plain goBack() lands on Spend. What no proposal in either family accounts for is that the guard is not the only place the modal's anchor is built: on web, a refresh while the modal is open goes through NavigationRoot.tsx, which rebuilds the modal over lastVisitedPath — the Inbox. Every proposal that (correctly) removes the racy navigate from beforeRemove therefore reintroduces this exact bug after a mid-modal refresh: the anchor reverts to Inbox and backdrop/goBack exits land there again. Search the thread — lastVisitedPath and NavigationRoot appear in no other proposal. This proposal fixes both anchor sites, which is the difference between reducing the bug and eliminating it.
Proposal
Please re-state the problem that we are trying to solve in this issue.
A migrated user opens the welcome modal, watches the 2-minute demo, returns, and clicks "Let's go!" — they land on Inbox instead of the Spend page. Backdrop dismissal has the same defect.
What is the root cause of that problem?
The modal is a dynamic route stacked over a base path, and closing it reveals that base. The intended "go to Spend" lives only in a beforeRemove listener, where the Navigation.navigate(SEARCH_ROOT…) is dispatched mid-GO_BACK and clobbered by the pop that is committing (and on the no-demo path can additionally be swallowed by shouldBlockWhileModalActive, since NAVIGATE is not an allowed action while the modal navigator is top-of-stack).
The anchor is built in two places, and both point at the wrong screen:
MigratedUserWelcomeModalGuard.ts L31–33 — anchors over Navigation.getActiveRoute() || ROUTES.HOME (Inbox for a fresh migrated user) when the guard redirects or proactively navigates.
NavigationRoot.tsx L131–134 — on web refresh with the modal URL, rebuilds the modal over lastVisitedPath:
Fixing only site 1 (or only the close handlers) leaves site 2 restoring an Inbox-anchored modal, so the bug survives any refresh while the modal is open.
What changes do you think we should make in order to solve the problem?
Anchor the modal over Spend at both sites, and reduce beforeRemove to the NVP side-effect only — no navigation is ever dispatched during a removal.
MigratedUserWelcomeModalGuard.ts — build the route over the canned expense-report Search route (export a small helper, e.g. getMigratedUserWelcomeBasePath(), so both sites share it):
This is config-supported: SCREENS.SEARCH.ROOT is already in MIGRATED_USER_WELCOME.entryScreens (ROUTES.ts L143–145).
NavigationRoot.tsx L131–134 — use the same Spend base path instead of lastVisitedPath when restoring the modal on refresh, so the restored modal is anchored identically to a freshly pushed one.
MigratedUserWelcomeModal.tsx — handleDismiss keeps only dismissProductTraining(...); handleClose stays a bare Navigation.goBack(). This matches the sibling-modal contract the codebase already follows (AutoSubmitModal uses useBeforeRemove for NVP persistence only).
Coverage: "Let's go!", backdrop press, hardware back, swipe, and Escape all terminate in GO_BACK — the one action type the guard always allows — over a Spend anchor; the demo and no-demo NVP timings are irrelevant because no NAVIGATE is ever dispatched; and a mid-modal web refresh restores the modal over Spend, so post-refresh exits land correctly too. The browser URL while the modal is open reflects Spend + suffix, so the state is deep-linkable and refresh-safe by construction.
Tests: extend MigratedUserWelcomeModalGuard.test.ts to assert redirect/proactive routes are anchored on SEARCH_ROOT; add a linking test asserting the refresh-restore path anchors on SEARCH_ROOT rather than lastVisitedPath; add a component test asserting beforeRemove performs only the NVP dismissal.
What alternative solutions did you explore? (Optional)
Close-handler fixes (onConfirm + shouldCloseOnConfirm={false}, direct navigate(), afterTransition, goBack(backToRoute)) all keep or work around a dispatch racing the pop, and each leaves at least one exit or the guard's NVP-timing window uncovered; none of them, nor a guard-only anchor change, addresses the NavigationRoot refresh restore, which re-anchors the modal over Inbox and brings the bug back. Keeping lastVisitedPath as the refresh anchor "to preserve context" was rejected as moot: the modal's only product-intended exit is Spend, and the current code already force-navigates there from every dismissal path.
changed the title [-]Full Story: "Let's go" button redirects to Inbox instead of Spend page after completing the demo[/-][+][$250] Full Story: "Let's go" button redirects to Inbox instead of Spend page after completing the demo[/+]on Jul 2, 2026
changed the title [-][$250] "Let's go" migrate welcome button redirects to Inbox instead of Spend page after completing the demo[/-][+][Due for payment 2026-07-17] [$250] "Let's go" migrate welcome button redirects to Inbox instead of Spend page after completing the demo[/+]on Jul 10, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.32-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@parasharrajat The PR fixing this issue has been merged! 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]
Activity
MelvinBot commentedon Jul 2, 2026
Proposal
What is the root cause of that problem?
The "Let's go!" button in the
MigratedUserWelcomeModalnever navigates to the Spend page — it only pops the modal, revealing whatever screen was underneath (the Inbox).The intended navigation to Spend lives only in the
handleDismisshandler, which is wired to react-navigation'sbeforeRemoveevent viauseBeforeRemove. But the confirm button doesn't call it directly — the modal passesonClose={handleClose}(Navigation.goBack()) and noonConfirmprop toFeatureTrainingContent. SinceshouldCloseOnConfirmdefaults totrue, clicking "Let's go!" collapses to justNavigation.goBack().The
handleDismiss→Navigation.navigate(SEARCH_ROOT)call then fires during the in-flightGO_BACKremoval, where it is dropped/overridden by the pop that is completing. The net result is thegoBacktarget (Inbox), not Spend.useBeforeRemoveeven documents this limitation and recommends replacing it withusePreventRemoveafter the react-navigation 7.x upgrade.Evidence (SHA
351f01d)onClose(goBack) but noonConfirm; the SEARCH_ROOT navigation is only insidehandleDismiss/useBeforeRemove:MigratedUserWelcomeModal.tsx:54-93handleConfirmrunsonConfirm?.()then, becauseshouldCloseOnConfirmdefaultstrue, callsonClose?.():FeatureTrainingContent.tsx:168and:255-260beforeRemovelimitation note + listener:useBeforeRemove.tsx:5-13ROUTES.SEARCH_ROOTwith a canned query, i.e. the same routehandleDismisstargets — so the intended destination is correct, only the navigation is lost:SearchTabButton.tsx:37-108,common.spend: 'Spend'inen.tsData flow:
Let's go!→handleConfirm→ (noonConfirm) →onClose→Navigation.goBack()pops the modal and emitsbeforeRemove→handleDismissfiresnavigate(SEARCH_ROOT)mid-removal → superseded by the pop → user lands on Inbox.What changes do you think we should make in order to solve the problem?
Make the confirm ("Let's go!") path navigate to the Spend page explicitly instead of relying on
goBack+ thebeforeRemovehandler:onConfirmtoFeatureTrainingContentthat runs the same logic ashandleDismiss(dismissProductTraining(...)+Navigation.navigate(ROUTES.SEARCH_ROOT...)), and setshouldCloseOnConfirm={false}so a subsequentgoBackdoesn't clobber the navigation.Alternatively (and more robustly for all dismissal paths — confirm, backdrop press, swipe), replace
handleClose'sNavigation.goBack()with a directNavigation.navigate(ROUTES.SEARCH_ROOT...), so every exit deterministically lands on Spend without depending onbeforeRemovetiming.What alternative solutions did you explore? (Optional)
Keeping the
beforeRemove/goBackapproach but reordering the calls is fragile because the navigate is issued during the removal dispatch. Long term, migrating offuseBeforeRemovetousePreventRemove(per the hook's own note) would remove this class of timing bug.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/95228)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
kitvasyl commentedon Jul 2, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
After a migrated user completes the 2-minute demo, clicking “Let's go” in the welcome modal opens Inbox instead of Spend.
What is the root cause of that problem?
In
src/components/MigratedUserWelcomeModal.tsx, the confirmation handler dismisses the modal and relies on the route underneath it. The demo navigation changes that underlying state, so returning from the demo leaves Inbox as the destination rather than Spend.What changes do you think we should make in order to solve the problem?
Update the welcome modal’s confirmation handler to explicitly navigate to the existing Spend route after dismissing the modal. This makes “Let's go” deterministic regardless of whether the user opened and completed the test-drive flow first. Add a regression test covering confirmation after returning from the demo.
What alternative solutions did you explore? (Optional)
We could restore the pre-demo route when leaving the test drive, but that couples the demo flow to this modal. Explicitly routing the modal’s CTA to its intended destination is smaller and more reliable.
shivang-goliyan commentedon Jul 2, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-02 19:05:10 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
A migrated user finishes the welcome modal (watches the 2-minute demo or just hits "Let's go") and expects to land on the Spend page. Instead they end up on Inbox. The button that's supposed to drop them into their expenses drops them somewhere else.
What is the root cause of that problem?
This is a regression from
cba9db2bff1(2026-06-17), the commit that migratedMigratedUserWelcomeModaltoCenteredModalLayout. Before that change the modal was a self-managedFeatureTrainingModal, and itsonCloserandismissProductTraining()and thenNavigation.navigate(SEARCH_ROOT)— so closing always resolved to Spend.After the migration the modal is a navigator screen, so closing it goes through
Navigation.goBack(), which just reveals whatever screen is underneath the overlay — Inbox. The "go to Spend" navigation got moved intouseBeforeRemove(handleDismiss)insrc/components/MigratedUserWelcomeModal.tsx(lines 54-60). When you confirm,FeatureTrainingContent.handleConfirmruns (shouldCloseOnConfirmdefaults totrue), which callsonClose→handleClose→goBack(). TheNavigation.navigate(SEARCH_ROOT)thathandleDismissdispatches from insidebeforeRemoveraces the pop that's already in flight and loses, so Inbox wins.You can see the intended contract in the sibling modals.
AutoSubmitModal,ChangePolicyEducationalModal, andHoldOrRejectEducationalModalall useuseBeforeRemovefor NVP cleanup only and do their real navigation inonConfirm.MigratedUserWelcomeModalis the only one that puts aNavigation.navigateto a different route insidebeforeRemove, and that's the bug.One thing worth calling out: this isn't only the button. Backdrop press and swipe-to-dismiss regressed the same way. The old
onClosesent all of those to Spend; now they all go throughgoBack()to Inbox with only the NVP cleanup running. The fix should cover the confirm path and the dismiss path together, not just "Let's go".What changes do you think we should make in order to solve the problem?
Split the two concerns so they match the pattern the sibling modals already follow. Keep
handleDismissfor cleanup only, and move the navigation into anonConfirmhandler withshouldCloseOnConfirm={false}so we don't fire a competinggoBack:Navigating to
SEARCH_ROOTtears down the overlay and lands on Spend in one action, which is exactly the pre-regression behavior. The samehandleConfirmshould back the backdrop/swipe dismiss so those paths land on Spend too.One thing to validate in a running web build:
MigratedUserWelcomeModalGuard.shouldBlockWhileModalActive()blocks non-DISMISS_MODAL/GO_BACKactions while the modal is active and training hasn't been dismissed yet (Onyx cache is async). In the reported demo pathdismissProductTraininghas already run via "Try 2-min demo", so the guard won't block the navigate. The no-demo path needs the dismiss to land before the navigate, so I'd confirm ordering on web before finalizing.There's no test asserting where confirm/close lands — only
MigratedUserWelcomeModalGuard.test.tsexists, and it covers the guard logic. I'd add a test that confirms both the button and the dismiss paths route to Spend so this doesn't silently regress again.What alternative solutions did you explore? (Optional)
Keep the navigation in
beforeRemovebut chain it after the pop settles (e.g. defer thenavigate). That works around the race instead of fixing the ownership problem, and it leavesMigratedUserWelcomeModalas the odd one out versus its siblings. Doing the navigation inonConfirmis cleaner and matches the established pattern. I also checked whether this was theTestDriveDemonavigator orgetTestDriveURL, but the code rules both out —getTestDriveURLonly picks which video plays, andTestDriveDemois a separate feature.ahmdshrif commentedon Jul 2, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
A migrated user opens the "Welcome to New Expensify!" modal, tries the 2-minute demo, comes back, and clicks "Let's go!". They should land on the expense/Spend Search page, but they land on Inbox instead.
What is the root cause of that problem?
PR
#93815(Refactor MigratedUserWelcome modal to CenteredModalLayout, merged 2026-06-22) moved the post-dismiss "navigate to Spend" out of the modal's explicit close handler into abeforeRemovelistener. A navigation dispatched from insidebeforeRemoveruns in the middle of the GO_BACK dispatch that is removing the modal, and never survives it. Chain:handleConfirmcallsonClose(App/src/components/FeatureTrainingContent.tsx
Lines 255 to 259 in 351f01d
handleClose = () => Navigation.goBack()(App/src/components/MigratedUserWelcomeModal.tsx
Line 62 in 351f01d
handleDismiss, registered viauseBeforeRemove(App/src/components/MigratedUserWelcomeModal.tsx
Lines 54 to 60 in 351f01d
#93815, this navigate ran inonCloseafter the modal was fully closed; now it runs inside the removal event.beforeRemove, and commits that state after the listeners return (useOnAction:shouldPreventRemoveemission precedessetState(result)). So theNavigation.navigate(SEARCH_ROOT…)dispatched by the listener pushes the Search route, and the outer GO_BACK — whose new state was computed from the pre-navigate state — immediately overwrites it. Last write wins; the Search push is silently discarded. (The repo already flags this hook as limited:App/src/hooks/useBeforeRemove.tsx
Line 5 in 351f01d
App/src/libs/Navigation/AppNavigator/createRootStackNavigator/RootStackRouter.ts
Lines 132 to 137 in 351f01d
shouldBlockWhileModalActiveblocks any non-GO_BACK/DISMISS action while the modal navigator is stillstate.routes.at(-1)and the dismissal NVP hasn't landed (App/src/libs/Navigation/guards/MigratedUserWelcomeModalGuard.ts
Lines 94 to 102 in 351f01d
dismissProductTrainingis an async optimistic Onyx merge (App/src/libs/actions/Welcome/index.ts
Lines 187 to 203 in 351f01d
onHelpalready dismissed the NVP (App/src/components/MigratedUserWelcomeModal.tsx
Lines 72 to 79 in 351f01d
App/src/libs/Navigation/guards/MigratedUserWelcomeModalGuard.ts
Lines 77 to 87 in 351f01d
Navigation.getActiveRoute() || ROUTES.HOME, i.e. Inbox for a freshly migrated user (App/src/libs/Navigation/guards/MigratedUserWelcomeModalGuard.ts
Lines 27 to 29 in 351f01d
Structural cause: a navigation side effect was attached to the removal event of the screen being removed, so it always races the removal that triggers it. Both dismissal paths (with and without the demo) are affected; the FullStory session captured the demo one.
What changes do you think we should make in order to solve the problem?
In
MigratedUserWelcomeModal.tsx, keepbeforeRemoveonly as the dismissal backstop and dispatch the Spend navigation after the pop commits, using the existingafterTransitionoption ofNavigation.goBack(App/src/libs/Navigation/Navigation.ts
Lines 539 to 541 in 351f01d
This covers both close entry points with one change: the confirm button (
FeatureTrainingContentL255-L259) and backdrop press (App/src/components/MigratedUserWelcomeModal.tsx
Lines 82 to 84 in 351f01d
handleClose. ByafterTransitiontime the modal is no longer top-of-stack, so neither the guard block nor the state clobber applies, on either NVP timing. Regression safety:onHelp, the guard, and dismissal semantics are unchanged — the only behavior change is that the navigate is dispatched after the pop instead of during it. (Destination stays the canned expense-report Search route the current code targets; if product wants the literal Spend tab, it's a one-word query change at the same site.)Why the obvious spot fix fails: calling
Navigation.navigate(...)synchronously right afterNavigation.goBack()(or leaving it insidehandleDismiss) still loses — the GO_BACK's popped state is computed before the listener/next line runs and committed after, overwriting the Search push; and whenever the async dismissal NVP hasn't propagated,shouldBlockWhileModalActiveswallows the NAVIGATE outright while the modal navigator is still on top.What alternative solutions did you explore? (Optional)
#93815shape (navigate directly inonClose, nogoBack) — the oldFeatureTrainingModalclosed itself via its hide-animation callback; with route-backedCenteredModalLayoutthe modal route must be popped explicitly, and navigating without popping leaves the modal route stacked under Search.shouldBlockWhileModalActiveto allow NAVIGATE during dismissal — touches shared guard logic, risks reintroducing the tab-switch race the guard exists to prevent, and doesn't fix the setState clobber (the demo path proves blocking isn't the only defeat).onConfirm— misses the backdrop-press dismissal, which also runshandleCloseand would still land on Inbox.oqildev commentedon Jul 2, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
aswin-s commentedon Jul 2, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web (Chrome, Safari/macOS), after a migrated user watches the 2-minute demo and clicks the "Let's go" button in
MigratedUserWelcomeModal, they land on the Inbox page instead of the Spend (Search/Reports) page. Clicking "Let's go" should navigate to the Spend page.What is the root cause of that problem?
In
src/components/MigratedUserWelcomeModal.tsx(lines 81–99),MigratedUserWelcomeModalrendersFeatureTrainingContentwithout passing anonConfirmprop — onlyonClose={handleClose}is wired, wherehandleClose = () => Navigation.goBack()(line 63).In
src/components/FeatureTrainingContent.tsx(lines 253–258),handleConfirmis:So pressing "Let's go" unconditionally calls
Navigation.goBack(), which pops the modal and reveals Inbox.The
useBeforeRemove(handleDismiss)at line 60 registers abeforeRemovelistener that callsNavigation.navigate(ROUTES.SEARCH_ROOT…). However,handleDismissnever callse.preventDefault()on the navigation event, so the originalgoBack()still proceeds. On web, the goBack() wins this race and the subsequentnavigate(SEARCH_ROOT)is effectively discarded — the user sees Inbox.What changes do you think we should make in order to solve the problem?
All changes are in
src/components/MigratedUserWelcomeModal.tsx:Add an explicit
handleConfirmcallback (around line 54, alongside the existinghandleDismiss):This mirrors what
handleDismissalready does.Navigation.navigate(SEARCH_ROOT)navigates the root navigator to the Spend page, which inherently closes the modal — no separategoBack()is needed.Pass
onConfirmandshouldCloseOnConfirm={false}to<FeatureTrainingContent>(around line 86–99):shouldCloseOnConfirm={false}is critical: without it,FeatureTrainingContent.handleConfirmcalls bothonConfirm(which navigates to SEARCH_ROOT) and thenonClose(which callsNavigation.goBack()), risking popping the user off the just-navigated Spend page or double-firinghandleDismissviabeforeRemove.Keep
useBeforeRemove(handleDismiss)unchanged for the backdrop-press / hardware-back dismissal path — when the user closes the modal without pressing "Let's go", this hook still navigates them to the Spend page.What alternative solutions did you explore? (Optional)
useBeforeRemove(handleDismiss): The existinghandleDismissalready callsnavigate(SEARCH_ROOT)inbeforeRemove. The problem is that withoute.preventDefault(), the goBack event proceeds alongside the navigate call. On web, thegoBack()wins the race, so this mechanism is unreliable for the "Let's go" button path.e.preventDefault()inhandleDismiss: Would intercept ALL removal events (including back-button / backdrop), causing the modal to be un-closeable unless you manually navigate. Worse,useBeforeRemoveexposes the raw event listener andhandleDismissdoesn't currently receive the event object — requires refactoring the hook.shouldCloseOnConfirm={false}alone (withoutonConfirm): Does nothing on its own —onConfirmis still a no-op, user still ends up on Inbox via the residualgoBack()on the close path.abbasifaizan70 commentedon Jul 2, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
A migrated user opens the welcome modal, watches the 2-minute demo, returns, and clicks "Let's go!" — they land on Inbox instead of the Spend page. Backdrop dismissal has the same defect.
What is the root cause of that problem?
The modal is a dynamic route stacked over a base path, and closing it reveals that base. The intended "go to Spend" lives only in a
beforeRemovelistener, where theNavigation.navigate(SEARCH_ROOT…)is dispatched mid-GO_BACKand clobbered by the pop that is committing (and on the no-demo path can additionally be swallowed byshouldBlockWhileModalActive, sinceNAVIGATEis not an allowed action while the modal navigator is top-of-stack).The anchor is built in two places, and both point at the wrong screen:
MigratedUserWelcomeModalGuard.tsL31–33 — anchors overNavigation.getActiveRoute() || ROUTES.HOME(Inbox for a fresh migrated user) when the guard redirects or proactively navigates.NavigationRoot.tsxL131–134 — on web refresh with the modal URL, rebuilds the modal overlastVisitedPath:Fixing only site 1 (or only the close handlers) leaves site 2 restoring an Inbox-anchored modal, so the bug survives any refresh while the modal is open.
What changes do you think we should make in order to solve the problem?
Anchor the modal over Spend at both sites, and reduce
beforeRemoveto the NVP side-effect only — no navigation is ever dispatched during a removal.MigratedUserWelcomeModalGuard.ts— build the route over the canned expense-report Search route (export a small helper, e.g.getMigratedUserWelcomeBasePath(), so both sites share it):This is config-supported:
SCREENS.SEARCH.ROOTis already inMIGRATED_USER_WELCOME.entryScreens(ROUTES.tsL143–145).NavigationRoot.tsxL131–134 — use the same Spend base path instead oflastVisitedPathwhen restoring the modal on refresh, so the restored modal is anchored identically to a freshly pushed one.MigratedUserWelcomeModal.tsx—handleDismisskeeps onlydismissProductTraining(...);handleClosestays a bareNavigation.goBack(). This matches the sibling-modal contract the codebase already follows (AutoSubmitModalusesuseBeforeRemovefor NVP persistence only).Coverage: "Let's go!", backdrop press, hardware back, swipe, and Escape all terminate in
GO_BACK— the one action type the guard always allows — over a Spend anchor; the demo and no-demo NVP timings are irrelevant because noNAVIGATEis ever dispatched; and a mid-modal web refresh restores the modal over Spend, so post-refresh exits land correctly too. The browser URL while the modal is open reflects Spend + suffix, so the state is deep-linkable and refresh-safe by construction.Tests: extend
MigratedUserWelcomeModalGuard.test.tsto assert redirect/proactive routes are anchored onSEARCH_ROOT; add a linking test asserting the refresh-restore path anchors onSEARCH_ROOTrather thanlastVisitedPath; add a component test assertingbeforeRemoveperforms only the NVP dismissal.What alternative solutions did you explore? (Optional)
Close-handler fixes (
onConfirm+shouldCloseOnConfirm={false}, directnavigate(),afterTransition,goBack(backToRoute)) all keep or work around a dispatch racing the pop, and each leaves at least one exit or the guard's NVP-timing window uncovered; none of them, nor a guard-only anchor change, addresses theNavigationRootrefresh restore, which re-anchors the modal over Inbox and brings the bug back. KeepinglastVisitedPathas the refresh anchor "to preserve context" was rejected as moot: the modal's only product-intended exit is Spend, and the current code already force-navigates there from every dismissal path.melvin-bot commentedon Jul 2, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @FitseTLT (
External)[-]Full Story: "Let's go" button redirects to Inbox instead of Spend page after completing the demo[/-][+][$250] Full Story: "Let's go" button redirects to Inbox instead of Spend page after completing the demo[/+]47 remaining items
[-][$250] "Let's go" migrate welcome button redirects to Inbox instead of Spend page after completing the demo[/-][+][Due for payment 2026-07-17] [$250] "Let's go" migrate welcome button redirects to Inbox instead of Spend page after completing the demo[/+]melvin-bot commentedon Jul 10, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jul 10, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.32-3 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-07-17. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jul 10, 2026
@parasharrajat The PR fixing this issue has been merged! 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]
melvin-bot commentedon Jul 13, 2026
@parasharrajat Whoops! This issue is 2 days overdue. Let's get this updated quick!
parasharrajat commentedon Jul 14, 2026
We can close this. All done here.
Beamanator commentedon Jul 14, 2026
no payment due here @parasharrajat ?
parasharrajat commentedon Jul 15, 2026
yes. Its a follow-up.