[$175] Digits - The background page switches to the Workspace Overview after reloading the page
If you havenβt already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: v9.5.36-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: https://github.com/Expensify/App/pull/105040 Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5.1 Safari App Component: Workspace Settings
Action Performed:
- Go to https://staging.new.expensify.com
- Login with [email protected]
- Go to Workspaces
- Create a control workspace with EUR currency
- Navigate to Workspaces > [Workspace] > Accounting
- Click Connect on Digits
- Verify that the "Update workspace currency?" modal appears, and that "Update workspace currency" opens the workspace currency page.
- Reload the page
Expected Result:
The background page should remain on the same page after reloading
Actual Result:
The background page switches to the Workspace Overview after reloading the page
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [ ] Windows: Chrome
- [x] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/a54d15a5-19e1-499a-a155-897caa414fa2
Applause Internal Information Exported by: Mita Rachim Bug ID: 7311791
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022120733971442721904
- Upwork Job ID: 2120733971442721904
- Last Price Increase: 2026-11-12
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/4a59b239a6c21ba7b717a1c112d59539eb491bbdbd0a8b9a59efd0e0ff35374d
You have been assigned to this deploy blocker because you recently merged this PR: https://github.com/Expensify/App/pull/105040
@lakchote @truph01 you have been assigned to this deploy blocker because you reviewed the offending PR: https://github.com/Expensify/App/pull/105040
@daledah you have been assigned to this deploy blocker because you authored the offending PR: https://github.com/Expensify/App/pull/105040
π¬ A slack conversation has been started in #expensify-open-source
:wave: 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:
- Identify the pull request that introduced this issue and revert it.
- Find someone who can quickly fix the issue.
- Fix the issue yourself.
π€ Web test steps verification results: β οΈ partial
Verified on dev NewDot web and created a Control workspace with EUR. Accounting navigation was absent, blocking the Digits flow; reload was explicitly prohibited by session policy.
| Step | Status |
|---|---|
1. Confirm environmentUsed the supplied web session on dev, not staging; this does not establish staging behavior. |
β |
2. Confirm authenticationConfirmed the supplied signed-in account without switching accounts. |
β |
3. Open WorkspacesOpened the workspace list. |
β |
4. Create a Control workspace with EURConfirmed EUR default currency and Control plan.![]() |
β |
5. Open AccountingAccounting navigation was absent, including after re-entering the workspace. |
β οΈ |
6. Click Digits ConnectBlocked because Accounting was unreachable. |
β οΈ |
7. Verify the currency prompt and Accounting backgroundNot verified in the browser. Source investigation identifies the introducing change as Add Digits connector entry and OAuth setup flow: ConnectToDigitsFlow:42β55 opens the shared Overview currency route without preserving Accounting as the originating page. |
β οΈ |
8. Verify the background after reloadReload was prohibited by session policy, so reproduction remains unconfirmed. The source-level mechanism explains the report: the currency route belongs to Overview, and reload reconstructs navigation from the URL, losing the live Accounting background.Recommendation: Roll forward with a route that preserves Accounting context; leave existing Overview entry points unchanged. Validate refresh and close/back from both entry points. Keep DeployBlockerCash pending validation. Globally remapping the shared currency route would break Overview callers. |
β οΈ |
https://github.com/user-attachments/assets/db42d983-b2e8-4c7e-8a66-f5273c264114
Removing the blocker label since itβs behind a beta and this issue also occurs on other pages
@MelvinBot please post a proposal
Current assignees @truph01 and @daledah are eligible for the External assigner, not assigning anyone new.
Job added to Upwork: https://www.upwork.com/jobs/~022120733971442721904
Proposal
What is the root cause of that problem?
The currency editor uses an Overview-owned URL even when opened from Accounting. Accounting remains behind the editor only in the current navigation history. After refresh, the URL reconstructs Overview instead.
This is a shared navigation limitation also affecting other currency-editor entry points, not unique to Digits.
Code evidence
- ConnectToDigitsFlow:42β55 opens the Overview currency route.
- WORKSPACE_TO_RHP:10β20 associates currency screens with Overview.
- getMatchingFullScreenRoute:161β178 uses that relationship to reconstruct the background.
- Workflows and Invoices also open the shared route.
What changes do you think we should make in order to solve the problem?
Use an origin-preserving dynamic currency route for non-Overview entry points, following the existing navigation pattern.
- Register the dynamic currency screen and update Accounting/Digits, Workflows, Invoices, and Expensify Card callers to use it.
- Reuse the existing currency editor, deriving its background and return destination from the originating route.
- Preserve that destination through the nested government-rate country selector and currency-save completion. Keep reimbursement and card-enrollment continuation parameters intact.
- Leave existing Overview currency URLs unchanged.
Add regression coverage for refresh, close/back, and save from each origin, including the nested country selector and existing Overview flow.
Implementation guidance and validation limits
The navigation guide:749β765 recommends dynamic routes for shared screens. The country selector:31β46 currently returns explicitly to Overview and must preserve the origin too.
This proposal is source-supported, not browser-confirmed: the previous test could not reach Accounting and did not verify refresh.
What alternative solutions did you explore? (Optional)
An Accounting-specific currency route would fix the Digits entry point but leave other affected callers unchanged. Globally changing the shared routeβs background would break Overview callers. Dynamic routing addresses the broader problem without adding deprecated backTo parameters.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](hyperlink) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Proposal
What is the root cause of that problem?
The currency editor opens on an Overview-owned URL even when the user reaches it from Accounting, so the origin is lost on refresh. ConnectToDigitsFlow navigates to ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policyID) (workspaces/:policyID/overview/currency) with no record that it was opened from Accounting, and WORKSPACE_TO_RHP.ts pins SCREENS.WORKSPACE.CURRENCY (and CURRENCY_GOVERNMENT_RATE_COUNTRY) under SCREENS.WORKSPACE.PROFILE (Overview). While the app is running, Accounting survives underneath only in the live navigation history; after a reload getMatchingFullScreenRoute rebuilds state from the URL alone and resolves Overview as the background. The nested government-rate country selector has the same hard-coded origin: goBackToCurrencyPage in WorkspaceOverviewCurrencyGovernmentRateCountryPage.tsx returns explicitly to the Overview currency route.
What changes do you think we should make in order to solve the problem?
Follow the DYNAMIC_IMPORTED_MEMBERS_ROLE precedent already in the codebase: that shared screen is deliberately left out of WORKSPACE_TO_RHP.ts so the dynamic base-path branch decides its background from the originating pane.
- Register a dynamic currency screen (e.g.
DYNAMIC_WORKSPACE_CURRENCY, plus a dynamic government-rate-country screen) inDYNAMIC_ROUTES/linkingConfig/config.tswith params{policyID}, mirroringDYNAMIC_IMPORTED_MEMBERS_ROLE, and removeCURRENCYandCURRENCY_GOVERNMENT_RATE_COUNTRYfrom thePROFILElist inWORKSPACE_TO_RHP.tssogetMatchingFullScreenRouteresolves the background from the originating central pane (Accounting, Workflows, Invoices, Card) instead of forcing Overview. LeaveROUTES.WORKSPACE_OVERVIEW_CURRENCYuntouched so existing Overview deep links keep working. - Point the non-Overview callers at the dynamic route:
ConnectToDigitsFlow(Digits), plus the Workflows, Invoices and Expensify Card currency entry points. - Thread the origin through the nested government-rate country selector: replace its hard-coded return to the Overview route with a return to the dynamic currency route, so back/save from the country step lands on the same origin.
- Keep the reimbursement and card-enrolment continuation params (
isForcedToChangeCurrency,shouldStartExpensifyCardEnrollment) intact through the dynamic route.
What will I verify?
Repro the issue steps on staging web (Control workspace with EUR β Accounting β Connect on Digits β "Update workspace currency" β reload: background must stay on Accounting), plus refresh, close/back and save from each origin (Accounting, Workflows, Invoices, Card) and the existing Overview flow, including the nested country-selector path, with regression coverage for each.
Contributor details
- Expensify email: [email protected]
- Upwork profile: https://www.upwork.com/freelancers/~01c5c6bc0e7d162f7b
Proposal
What is the root cause of that problem?
ConnectToDigitsFlow opens ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policyID) with no backTo. https://github.com/Expensify/App/blob/f3538e5728146439c4decfbad05907b2f079f826/src/components/ConnectToDigitsFlow/index.tsx#L54
On reload the URL is /workspaces/:id/overview/currency. getMatchingFullScreenRoute can only use the static WORKSPACE_TO_RHP relation, which puts SCREENS.WORKSPACE.CURRENCY under the Profile (Overview) screen. https://github.com/Expensify/App/blob/f3538e5728146439c4decfbad05907b2f079f826/src/libs/Navigation/helpers/getMatchingFullScreenRoute.ts#L161-L178
The same function already rebuilds the background from a backTo query param for non-dynamic screens, which is how other RHP screens survive a reload. https://github.com/Expensify/App/blob/f3538e5728146439c4decfbad05907b2f079f826/src/libs/Navigation/helpers/getMatchingFullScreenRoute.ts#L69-L90
The Overview currency route's getRoute and the currency page never accept or pass a backTo, so no caller can tell the reload which page was underneath. https://github.com/Expensify/App/blob/f3538e5728146439c4decfbad05907b2f079f826/src/ROUTES.ts#L3257-L3272
Workflows and Invoices open the same route the same way, so they lose their background the same way.
What changes do you think we should make in order to solve the problem?
- In
ROUTES.ts, letWORKSPACE_OVERVIEW_CURRENCY.getRoutetake an optionalbackToand add it to the query string (the repo already hasgetUrlWithBackToParam). Do the same forWORKSPACE_OVERVIEW_CURRENCY_GOVERNMENT_RATE_COUNTRY, which keeps the same background. - Add
backToto the params type ofSCREENS.WORKSPACE.CURRENCYandCURRENCY_GOVERNMENT_RATE_COUNTRYinlibs/Navigation/types.ts. - In
ConnectToDigitsFlow, callgetRoute(policyID, {backTo: ROUTES.POLICY_ACCOUNTING.getRoute(policyID)}). After a reloadgetMatchingFullScreenRoutethen resolves Accounting as the background. - In
WorkspaceOverviewCurrencyPage, readroute.params.backTo. Pass it toapplyWorkspaceCurrencyChange(the hook already acceptsbackTo) and to the government-rate-country route, and use it for the header back button. - Optionally pass
backTofrom the Workflows and Invoices callers too, so they behave the same way. - Add a unit test next to the existing navigation tests (
getMatchingFullScreenRoute): forworkspaces/1/overview/currency?backTo=workspaces/1/accounting, the matched full-screen route is the Accounting screen. WithoutbackToit stays Overview.
What alternative solutions did you explore? (Optional)
- Add a new dynamic route for the currency page with
entryScreens. This gives a clean URL but needs a new route and screen, and the shared currency page has several entry points. - Special-case Digits inside
getMatchingFullScreenRoute. This hides the symptom at the read site and can't tell which page was underneath.
Proposal
Please re-state the problem that we are trying to solve in this issue
In Workspace Settings > Accounting, clicking Connect on Digits opens the "Update workspace currency?" modal. Clicking "Update workspace currency" navigates to the currency editor RHP. When the page is reloaded in the browser, the background fullscreen page switches to Workspace Overview instead of remaining on Accounting.
What is the root cause of that problem?
In src/components/ConnectToDigitsFlow/index.tsx:54:
Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policyID));
ConnectToDigitsFlow opens the currency editor without passing backTo.
On page reload, getMatchingFullScreenRoute.ts:60 checks isRouteWithBackToParam(route). Because backTo is missing from the URL search params, it falls through to RHP_TO_WORKSPACE[route.name] (line 173). In src/libs/Navigation/linkingConfig/RELATIONS/WORKSPACE_TO_RHP.ts:16, SCREENS.WORKSPACE.CURRENCY is statically mapped under SCREENS.WORKSPACE.PROFILE (Overview). Consequently, the background fullscreen route is reconstructed as Overview rather than Accounting.
What changes do you think we should make in order to solve the problem?
- In
src/ROUTES.ts, updateROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRouteto accept optionalbackTo?: string:
WORKSPACE_OVERVIEW_CURRENCY: {
route: 'workspaces/:policyID/overview/currency',
getRoute: (
policyID: string,
{isForcedToChangeCurrency, shouldStartExpensifyCardEnrollment, backTo}: {isForcedToChangeCurrency?: boolean; shouldStartExpensifyCardEnrollment?: boolean; backTo?: string} = {},
) => {
const params = new URLSearchParams();
if (isForcedToChangeCurrency) {
params.set('isForcedToChangeCurrency', 'true');
}
if (shouldStartExpensifyCardEnrollment) {
params.set('shouldStartExpensifyCardEnrollment', 'true');
}
if (backTo) {
params.set('backTo', backTo);
}
const query = params.toString();
return `workspaces/${policyID}/overview/currency${query ? `?${query}` : ''}` as const;
},
},
- In
src/components/ConnectToDigitsFlow/index.tsx:54, pass the current accounting route asbackTo:
Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policyID, {backTo: ROUTES.WORKSPACE_ACCOUNTING.getRoute(policyID)}));
- In
src/pages/workspace/WorkspaceOverviewCurrencyPage.tsx: Passroute.params?.backTotoNavigation.goBackon the header back button and selection dismiss so back navigation returns to Accounting.
On reload, getMatchingFullScreenRoute.ts:60-84 automatically detects backTo in the URL query params, parses ROUTES.WORKSPACE_ACCOUNTING, and reconstructs SCREENS.WORKSPACE.ACCOUNTING behind the RHP without modifying static WORKSPACE_TO_RHP relations.
What alternative solutions did you explore? (Optional)
Modifying WORKSPACE_TO_RHP.ts or getMatchingFullScreenRoute directly would break standard navigation where Currency is opened from Overview. Utilizing the existing isRouteWithBackToParam mechanism in getMatchingFullScreenRoute is the cleanest, surgical pattern already established in the app.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01a7e49dd3ec2ddd6c
β Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
What is the root cause of that problem?
-
Missing
backToin Navigation Call (src/components/ConnectToDigitsFlow/index.tsx:54):Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policyID));ConnectToDigitsFlownavigates toROUTES.WORKSPACE_OVERVIEW_CURRENCYwithout specifying abackToparameter. -
Full-screen Reconstruction on Browser Reload (
src/libs/Navigation/helpers/getMatchingFullScreenRoute.ts:60β175):- On page refresh,
getMatchingFullScreenRoutereconstructs the underlying fullscreen page behind the RHP modal. - At line 60, it checks
if (isRouteWithBackToParam(route)). BecausebackTois missing from the URL search query, it skips dynamic derivation frombackToand falls back to static RHP relations at line 173 (RHP_TO_WORKSPACE[route.name]). - In
src/libs/Navigation/linkingConfig/RELATIONS/WORKSPACE_TO_RHP.ts:16,SCREENS.WORKSPACE.CURRENCYis statically declared as a sub-route ofSCREENS.WORKSPACE.PROFILE(Workspace Overview). - Consequently, the browser reconstructs Workspace Overview behind the RHP instead of the Accounting page from which the user initiated the connection.
- On page refresh,
-
Existing Pre-built Infrastructure Already Handles
backTo:- In
src/hooks/useApplyWorkspaceCurrencyChange.ts:32,ApplyWorkspaceCurrencyChangeOptionsalready definesbackTo?: Routeand lines 78β82 already execute:if (backTo) { Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.goBack(backTo)); return; } - However,
ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoutedoes not exposebackToin its parameter options, andWorkspaceOverviewCurrencyPagedoes not passroute.params?.backTointoapplyWorkspaceCurrencyChangeorHeaderWithBackButton.onBackButtonPress.
- In
What changes do you think we should make in order to solve the problem?
1. Update ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute in src/ROUTES.ts
Accept optional backTo?: Route and serialize it into query parameters:
WORKSPACE_OVERVIEW_CURRENCY: {
route: 'workspaces/:policyID/overview/currency',
getRoute: (
policyID: string,
{isForcedToChangeCurrency, shouldStartExpensifyCardEnrollment, backTo}: {isForcedToChangeCurrency?: boolean; shouldStartExpensifyCardEnrollment?: boolean; backTo?: Route} = {},
) => {
const params = new URLSearchParams();
if (isForcedToChangeCurrency) {
params.set('isForcedToChangeCurrency', 'true');
}
if (shouldStartExpensifyCardEnrollment) {
params.set('shouldStartExpensifyCardEnrollment', 'true');
}
if (backTo) {
params.set('backTo', backTo);
}
const query = params.toString();
return `workspaces/${policyID}/overview/currency${query ? `?${query}` : ''}` as const;
},
},
2. Pass backTo in ConnectToDigitsFlow (src/components/ConnectToDigitsFlow/index.tsx:54)
if (shouldBlockCurrencyChange || result.action !== ModalActions.CONFIRM) {
return;
}
Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policyID, {backTo: ROUTES.WORKSPACE_ACCOUNTING.getRoute(policyID)}));
};
3. Connect backTo in src/pages/workspace/WorkspaceOverviewCurrencyPage.tsx
Ensure selecting a currency or tapping Back returns to backTo (Accounting):
const isForcedToChangeCurrency = !!route.params?.isForcedToChangeCurrency;
const shouldStartExpensifyCardEnrollment = !!route.params?.shouldStartExpensifyCardEnrollment;
const backTo = route.params?.backTo;
const shouldBlockCurrencyChange = useShouldBlockCurrencyChange(policy?.id);
const {showConfirmModal} = useConfirmModal();
const applyWorkspaceCurrencyChange = useApplyWorkspaceCurrencyChange(policy);
const applyCurrencySelection = (currencyCode: string) => {
applyWorkspaceCurrencyChange(currencyCode, {isForcedToChangeCurrency, shouldStartExpensifyCardEnrollment, backTo});
};
>
<HeaderWithBackButton
title={translate('workspace.editor.currencyInputLabel')}
onBackButtonPress={() => Navigation.goBack(backTo)}
/>
Why this completely fixes the reload behavior:
In src/libs/Navigation/helpers/getMatchingFullScreenRoute.ts:60β84, when the page reloads, isRouteWithBackToParam(route) evaluates to true because ?backTo=workspaces%2F<policyID>%2Faccounting is in the URL.
getMatchingFullScreenRoute extracts backTo, resolves it via getAdaptedStateFromPath, and mounts SCREENS.WORKSPACE.ACCOUNTING behind the RHP. Static relations in WORKSPACE_TO_RHP.ts remain completely untouched and standard Overview -> Currency navigation continues to work without regression.
What alternative solutions did you explore? (Optional)
- Modifying static
WORKSPACE_TO_RHP.tsor hardcoding Digits ingetMatchingFullScreenRoute: MappingSCREENS.WORKSPACE.CURRENCYunder Accounting would break standard workspace profile settings where Currency is edited from Overview. Utilizing Expensify's canonicalbackToquery param mechanism ingetMatchingFullScreenRouteis dynamic, safe, and leverages already-implemented code inuseApplyWorkspaceCurrencyChange.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/ConnectToDigitsFlowTest.tsx:
Verify that when promptCurrencyChange confirms, Navigation.navigate is invoked with ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policyID, {backTo: ROUTES.WORKSPACE_ACCOUNTING.getRoute(policyID)}).
In tests/navigation/getMatchingFullScreenRouteTest.ts:
Verify that an RHP currency route with backTo=workspaces/:policyID/accounting returns the Accounting screen as the underlying full-screen route on cold reload.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
β Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue
When navigating to Workspaces > [Workspace] > Accounting on a non-USD workspace, clicking Connect on Digits opens the "Update workspace currency?" modal, and confirming navigates to the workspace currency selector RHP. However, when the browser page is reloaded while the currency RHP is open, the background full-screen page switches from Accounting to Overview.
What is the root cause of that problem?
- In
src/components/ConnectToDigitsFlow/index.tsx:54,promptCurrencyChangenavigates to the static Overview-owned currency route:
(The same pattern is used inNavigation.navigate(ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policyID));src/pages/workspace/workflows/tabs/WorkflowsPaymentsTab.tsx:140,src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx:91, andsrc/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx:126.) - Because
ROUTES.WORKSPACE_OVERVIEW_CURRENCYproduces/workspaces/:policyID/overview/currency, the originating screen context (Accounting,Workflows,Invoices, orExpensify Card) exists only in in-memory navigation state. - On a browser reload,
getAdaptedStateFromPath(src/libs/Navigation/helpers/getAdaptedStateFromPath.ts:143) callsgetMatchingFullScreenRoute(focusedRoute, true). SinceSCREENS.WORKSPACE.CURRENCY(andSCREENS.WORKSPACE.CURRENCY_GOVERNMENT_RATE_COUNTRY) are static screens mapped underSCREENS.WORKSPACE.PROFILEinsrc/libs/Navigation/linkingConfig/RELATIONS/WORKSPACE_TO_RHP.ts:15-17,getMatchingFullScreenRoutereconstructsSCREENS.WORKSPACE.PROFILE(Overview) as the background full-screen route. - Furthermore, when auto-updating government distance rates is enabled and a shared currency (
EUR) is selected,WorkspaceOverviewCurrencyPage.tsx:56-61navigates toROUTES.WORKSPACE_OVERVIEW_CURRENCY_GOVERNMENT_RATE_COUNTRY, andWorkspaceOverviewCurrencyGovernmentRateCountryPage.tsx:33,45hardcodesROUTES.WORKSPACE_OVERVIEW.getRoute(policyID)as itsbackTodestination upon saving.
What changes do you think we should make in order to solve the problem?
Per contributingGuides/NAVIGATION.md:749-765 and the lint rule in src/libs/Navigation/paramLists/WorkspaceSettingsParamList.ts:82 ("Do not add new backTo params to screens"), we should convert the workspace currency selector and its nested government-rate country selector to dynamic routes (matching DYNAMIC_WORKSPACE_OVERVIEW_ADDRESS and DYNAMIC_WORKSPACE_OVERVIEW_PLAN).
Even better, because currency and currency/government-rate-country/:currencyCode under /workspaces/:policyID/overview are identical to the existing URLs (/workspaces/:policyID/overview/currency and /workspaces/:policyID/overview/currency/government-rate-country/:currencyCode), making them dynamic routes preserves the exact existing Overview URLs while automatically preserving Accounting, Workflows, Invoices, and Expensify Card as the base path (/workspaces/:policyID/accounting/currency, etc.) on reload, back, and save!
-
Define dynamic routes in
src/ROUTES.ts(DYNAMIC_ROUTES):WORKSPACE_CURRENCY: { path: 'currency', entryScreens: [ SCREENS.WORKSPACE.PROFILE, SCREENS.WORKSPACE.ACCOUNTING.ROOT, SCREENS.WORKSPACE.WORKFLOWS, SCREENS.WORKSPACE.INVOICES, SCREENS.WORKSPACE.EXPENSIFY_CARD, ], getRoute: ({isForcedToChangeCurrency, shouldStartExpensifyCardEnrollment}: {isForcedToChangeCurrency?: boolean; shouldStartExpensifyCardEnrollment?: boolean} = {}) => getUrlWithParams('currency', { isForcedToChangeCurrency: isForcedToChangeCurrency ? 'true' : undefined, shouldStartExpensifyCardEnrollment: shouldStartExpensifyCardEnrollment ? 'true' : undefined, }), queryParams: ['isForcedToChangeCurrency', 'shouldStartExpensifyCardEnrollment'], }, WORKSPACE_CURRENCY_GOVERNMENT_RATE_COUNTRY: { path: 'government-rate-country/:currencyCode', entryScreens: [SCREENS.WORKSPACE.DYNAMIC_WORKSPACE_CURRENCY], getRoute: ( currencyCode: string, {isForcedToChangeCurrency, shouldStartExpensifyCardEnrollment}: {isForcedToChangeCurrency?: boolean; shouldStartExpensifyCardEnrollment?: boolean} = {}, ) => getUrlWithParams(`government-rate-country/${currencyCode}`, { isForcedToChangeCurrency: isForcedToChangeCurrency ? 'true' : undefined, shouldStartExpensifyCardEnrollment: shouldStartExpensifyCardEnrollment ? 'true' : undefined, }), queryParams: ['isForcedToChangeCurrency', 'shouldStartExpensifyCardEnrollment'], }, -
Register the dynamic screens in
src/SCREENS.ts,src/libs/Navigation/paramLists/WorkspaceSettingsParamList.ts,src/libs/Navigation/linkingConfig/config.ts, andsrc/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx:- Rename
SCREENS.WORKSPACE.CURRENCYβSCREENS.WORKSPACE.DYNAMIC_WORKSPACE_CURRENCY('Dynamic_Workspace_Overview_Currency') andSCREENS.WORKSPACE.CURRENCY_GOVERNMENT_RATE_COUNTRYβSCREENS.WORKSPACE.DYNAMIC_WORKSPACE_CURRENCY_GOVERNMENT_RATE_COUNTRY('Dynamic_Workspace_Overview_Currency_Government_Rate_Country'), and includepolicyID: stringinWorkspaceSettingsParamList(merged automatically from the underlying entry screen bygetStateFromPath.ts:51-54). - Remove
CURRENCYandCURRENCY_GOVERNMENT_RATE_COUNTRYfromWORKSPACE_TO_RHP.tssogetDynamicRouteAdaptedState(src/libs/Navigation/helpers/dynamicRoutesUtils/getDynamicRouteAdaptedState.ts:78-118) andgetMatchingFullScreenRoute(src/libs/Navigation/helpers/getMatchingFullScreenRoute.ts:232-265) strip the dynamic suffixes (government-rate-country/:currencyCodeandcurrency) and reconstruct the exact originating full-screen route (Accounting,Overview,Workflows,Invoices, orExpensify Card) underneath the RHP on reload.
- Rename
-
Update
WorkspaceOverviewCurrencyPage.tsxandWorkspaceOverviewCurrencyGovernmentRateCountryPage.tsxto useuseDynamicBackPath:- In
src/pages/workspace/WorkspaceOverviewCurrencyPage.tsx:const backPath = useDynamicBackPath(DYNAMIC_ROUTES.WORKSPACE_CURRENCY.path);- Pass
backTo: backPathintoapplyWorkspaceCurrencyChange(currencyCode, {isForcedToChangeCurrency, shouldStartExpensifyCardEnrollment, backTo: backPath}). - Use
Navigation.goBack(backPath)forHeaderWithBackButton'sonBackButtonPressandfullPageNotFoundViewProps.onLinkPress. - When navigating to the government-rate country selector for shared
EURcurrencies, call:Navigation.navigate( createDynamicRoute( DYNAMIC_ROUTES.WORKSPACE_CURRENCY_GOVERNMENT_RATE_COUNTRY.getRoute(item.currencyCode, { isForcedToChangeCurrency, shouldStartExpensifyCardEnrollment, }), ), );
- Pass
- In
src/pages/workspace/WorkspaceOverviewCurrencyGovernmentRateCountryPage.tsx:const currencyBackPath = useDynamicBackPath(DYNAMIC_ROUTES.WORKSPACE_CURRENCY_GOVERNMENT_RATE_COUNTRY.path); const originBackPath = stripDynamicRouteSuffixFromPath(currencyBackPath, DYNAMIC_ROUTES.WORKSPACE_CURRENCY.path);- Use
Navigation.goBack(currencyBackPath)ingoBackToCurrencyPage. - Pass
backTo: originBackPath(instead of hardcodedROUTES.WORKSPACE_OVERVIEW.getRoute(policyID)) toapplyWorkspaceCurrencyChangeinsaveCountry.
- Use
- In
-
Update callers to navigate via
createDynamicRoute:src/components/ConnectToDigitsFlow/index.tsx:54:Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.WORKSPACE_CURRENCY.path, ROUTES.POLICY_ACCOUNTING.getRoute(policyID)));src/pages/workspace/WorkspaceOverviewPage.tsx:167:Navigation.navigate(buildDynamicRoute(DYNAMIC_ROUTES.WORKSPACE_CURRENCY.path));src/pages/workspace/workflows/tabs/WorkflowsPaymentsTab.tsx:140:Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.WORKSPACE_CURRENCY.getRoute({isForcedToChangeCurrency: true}), ROUTES.WORKSPACE_WORKFLOWS.getRoute(policy.id)));src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx:91:Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.WORKSPACE_CURRENCY.getRoute({isForcedToChangeCurrency: true}), ROUTES.WORKSPACE_INVOICES.getRoute(policy.id)));src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx:126:Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.WORKSPACE_CURRENCY.getRoute({shouldStartExpensifyCardEnrollment: true}), ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policy.id)));
What alternative solutions did you explore? (Optional)
- Adding a
backToquery parameter toROUTES.WORKSPACE_OVERVIEW_CURRENCY: Explicitly discouraged bycontributingGuides/NAVIGATION.mdandWorkspaceSettingsParamList.ts:82(no-restricted-syntax -- backTo usages in this file are legacy. Do not add new backTo params to screens). - Keeping
CURRENCYinWORKSPACE_TO_RHP.tswhile adding a dynamic route: Any screen remaining inRHP_TO_WORKSPACEhits theif (RHP_TO_WORKSPACE[route.name])branch ingetMatchingFullScreenRoute.ts:166before reaching the dynamic route branch at line 232, which would still forceSCREENS.WORKSPACE.PROFILEon reload. Removing it fromWORKSPACE_TO_RHP.ts(just likeDYNAMIC_IMPORTED_MEMBERS_ROLE) ensures dynamic base-path resolution works on both cold reload and stacked country selection.
Contributor Details
- Expensify Account Email: [email protected]
- Upwork Profile Link: https://www.upwork.com/freelancers/~0105c450e4a0cf3079
daledah fixed this in https://github.com/Expensify/App/pull/106748, which has been on production since Nov 18. It's part of the Digits project, which gets paid in one issue at the end like Zoho Books, so I'm adding Skip Payment and closing this.