fix wrong navigation after adding personal bank account successfully in wallet page#89649
fix wrong navigation after adding personal bank account successfully in wallet page#89649apeyada wants to merge 2 commits intoExpensify:mainfrom
Conversation
…dding personal bank account
|
@mkhutornyi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09bcf79de4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } else { | ||
| Navigation.goBack(backTo); | ||
| } |
There was a problem hiding this comment.
Restore navigator-aware fallback when
backTo is missing
When this flow is opened without a backTo param (e.g. Navigation.navigate(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.route) in src/components/SettlementButton/index.tsx:444, and the non-admin verify flow in src/pages/settings/Wallet/DynamicAddBankAccountVerifyAccountPage.tsx:15), this branch now calls Navigation.goBack(backTo) with undefined. That drops to generic goBack() behavior instead of the previous navigator-specific fallback (SETTINGS_SPLIT => wallet, REPORTS_SPLIT => closeRHPFlow), so finishing/canceling can pop to an intermediate substep or no-op if there is no back history, rather than reliably exiting the bank-account flow.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@MelvinBot what do you think #89649 (comment)? Is this page reachable on other tabs like Inbox, Spend (not only Account->Wallet)?
There was a problem hiding this comment.
The review comment raises a valid point. Yes, this page is reachable from tabs other than Account > Wallet, and several of those entry points don't pass a backTo param:
- SettlementButton (personal payments, line 444) navigates with the plain
.routestring — nobackTo. - DynamicAddBankAccountVerifyAccountPage (line 15) — also uses plain
.route. - ReportUtils.getBankAccountRoute() (line 1813) — returns plain
.routefor non-policy-expense-chat cases (e.g. personal payment from Inbox).
The route's entryScreens in ROUTES.ts explicitly include SCREENS.REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.SEARCH.ROOT, and SCREENS.RIGHT_MODAL.SEARCH_REPORT, confirming reachability from Inbox and Search/Spend tabs.
So when backTo is undefined, the new code calls Navigation.goBack(undefined) → generic goBack(), which may not reliably exit the flow. The previous navigator-aware switch (SETTINGS_SPLIT → wallet, REPORTS_SPLIT → closeRHPFlow) handled these cases correctly. Additionally, hardcoding ROUTES.SETTINGS_WALLET in the shouldIgnoreBackToParam=true branch would be wrong if the user entered from a non-wallet context.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
The existing helper if (route.name === NAVIGATORS.TAB_NAVIGATOR && route.state) {
const index = route.state.index ?? 0;
return route.state.routes?.at(index)?.name;
}There's even a ready-made helper const topmostFullScreenRoute = rootState.routes.findLast((route) => isFullScreenName(route.name));
return getActiveTabName(topmostFullScreenRoute) === NAVIGATORS.REPORTS_SPLIT_NAVIGATOR;Proposed fix for const goBack = (shouldIgnoreBackToParam = false) => {
if (backTo && !shouldIgnoreBackToParam) {
Navigation.goBack(backTo);
return;
}
const rootState = navigationRef.getRootState() as State<RootNavigatorParamList>;
const topmostFullScreenRoute = rootState?.routes.findLast((r) => isFullScreenName(r.name));
const activeTab = getActiveTabName(topmostFullScreenRoute);
switch (activeTab) {
case NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR:
Navigation.goBack(ROUTES.SETTINGS_WALLET);
break;
case NAVIGATORS.REPORTS_SPLIT_NAVIGATOR:
Navigation.closeRHPFlow();
break;
default:
Navigation.goBack();
break;
}
};This preserves the original behavior for all entry points (Inbox, Spend, Wallet) while still simplifying the memoization as the PR intends. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Code ReviewThe updated diff (using Two items worth noting:
The navigation logic itself looks correct. |
Explanation of Change
Fixed Issues
$ #89017
PROPOSAL: #89017 (comment)
Tests
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
msafari.mov
MacOS: Chrome / Safari
web.mov