From e4b92a388edd76d67b5869fd40b71b8d06decb13 Mon Sep 17 00:00:00 2001 From: Jairo Calmon Date: Thu, 18 Jun 2026 02:11:54 -0300 Subject: [PATCH 1/9] Fix NotFoundPage flash on card details opened via deep link --- src/ONYXKEYS.ts | 4 +++ src/libs/actions/Card.ts | 18 +++++++++++- .../Wallet/ExpensifyCardPage/index.tsx | 28 +++++++++++++++++-- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 67dd60ea1de0..32bbc45e470c 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -406,6 +406,9 @@ const ONYXKEYS = { /** Set when we are loading the bulk change approver page */ IS_LOADING_BULK_CHANGE_APPROVER_PAGE: 'isLoadingBulkChangeApproverPage', + /** Set when we are fetching the card details for a single card from the server */ + IS_LOADING_CARD_DETAILS: 'isLoadingCardDetails', + /** Is report data loading? */ IS_LOADING_APP: 'isLoadingApp', @@ -1539,6 +1542,7 @@ type OnyxValuesMapping = { [ONYXKEYS.IS_LOADING_PAYMENT_METHODS]: boolean; [ONYXKEYS.IS_LOADING_SHARE_BANK_ACCOUNTS]: boolean; [ONYXKEYS.IS_LOADING_BULK_CHANGE_APPROVER_PAGE]: boolean; + [ONYXKEYS.IS_LOADING_CARD_DETAILS]: boolean; [ONYXKEYS.IS_LOADING_POLICY_CODING_RULES_PREVIEW]: boolean; [ONYXKEYS.IS_LOADING_REPORT_DATA]: boolean; [ONYXKEYS.IS_SEARCH_FILTERS_CARD_DATA_LOADED]: boolean; diff --git a/src/libs/actions/Card.ts b/src/libs/actions/Card.ts index bfec860f560a..bee934a3afd9 100644 --- a/src/libs/actions/Card.ts +++ b/src/libs/actions/Card.ts @@ -1563,7 +1563,23 @@ function openCardDetailsPage(cardID: number) { cardID, }; - API.read(READ_COMMANDS.OPEN_CARD_DETAILS_PAGE, parameters); + const optimisticData: Array> = [ + { + onyxMethod: Onyx.METHOD.SET, + key: ONYXKEYS.IS_LOADING_CARD_DETAILS, + value: true, + }, + ]; + + const finallyData: Array> = [ + { + onyxMethod: Onyx.METHOD.SET, + key: ONYXKEYS.IS_LOADING_CARD_DETAILS, + value: false, + }, + ]; + + API.read(READ_COMMANDS.OPEN_CARD_DETAILS_PAGE, parameters, {optimisticData, finallyData}); } type ContinuousReconciliationUpdate = OnyxUpdate< diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx index 5ea4af7906b2..9684887fb255 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx @@ -1,5 +1,5 @@ import {useFocusEffect} from '@react-navigation/native'; -import React, {useCallback, useMemo, useState} from 'react'; +import React, {useCallback, useEffect, useMemo, useState} from 'react'; import type {ViewStyle} from 'react-native'; import {View} from 'react-native'; import type {OnyxCollection} from 'react-native-onyx'; @@ -11,6 +11,7 @@ import CardPreview from '@components/CardPreview'; import ConfirmModal from '@components/ConfirmModal'; import DotIndicatorMessage from '@components/DotIndicatorMessage'; import FrozenCardHeader from '@components/FrozenCardHeader'; +import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import {useLockedAccountActions, useLockedAccountState} from '@components/LockedAccountModalProvider'; import MenuItem from '@components/MenuItem'; @@ -28,7 +29,7 @@ import useNetwork from '@hooks/useNetwork'; import useNonPersonalCardList from '@hooks/useNonPersonalCardList'; import useOnyx from '@hooks/useOnyx'; import useThemeStyles from '@hooks/useThemeStyles'; -import {freezeCard, unfreezeCard} from '@libs/actions/Card'; +import {freezeCard, openCardDetailsPage, unfreezeCard} from '@libs/actions/Card'; import {resetValidateActionCodeSent} from '@libs/actions/User'; import navigateToCardTransactions from '@libs/CardNavigationUtils'; import { @@ -63,6 +64,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import type {Policy} from '@src/types/onyx'; +import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; import {useExpensifyCardActions, useExpensifyCardState} from './ExpensifyCardContextProvider'; type ExpensifyCardPageProps = @@ -94,6 +96,8 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const [account] = useOnyx(ONYXKEYS.ACCOUNT); const [countryByIp] = useOnyx(ONYXKEYS.COUNTRY); const cardList = useNonPersonalCardList(); + const [, cardListResult] = useOnyx(ONYXKEYS.CARD_LIST); + const [isLoadingCardDetailsFromServer] = useOnyx(ONYXKEYS.IS_LOADING_CARD_DETAILS); const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${cardList?.[cardID]?.fundID}`); const styles = useThemeStyles(); const {isOffline} = useNetwork(); @@ -128,6 +132,12 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const revealedPIN = useRevealedPhysicalCardPin(String(currentPhysicalCard?.cardID)); const scaRevealedCardDetails = useAllRevealedVirtualCardDetails(); + // When opening this page directly (e.g. via a deep link from OldDot), the card may not be in CARD_LIST yet, so we + // fetch it from the server on mount. Until that fetch settles we show a loading indicator rather than the NotFoundPage. + useEffect(() => { + openCardDetailsPage(Number(cardID)); + }, [cardID]); + // Resets card details and revealed PIN when navigating away from the page. useFocusEffect( useCallback(() => { @@ -272,6 +282,20 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const navigateToTransactions = () => navigateToCardTransactions(cardID); + // The card details are fetched from the server on mount, so while CARD_LIST is still hydrating or that fetch is in + // flight we show the loading indicator instead of the NotFoundPage. When offline we cannot fetch, so we rely solely on + // whatever is already cached. + const isLoadingCardData = !currentCard && !isOffline && (isLoadingOnyxValue(cardListResult) || isLoadingCardDetailsFromServer !== false); + + if (isLoadingCardData) { + return ( + + ); + } + if (!currentCard) { return Navigation.goBack(ROUTES.SETTINGS_WALLET)} />; } From fb6f4e1c9b1ba672cf0330bf03d42869f1750ad3 Mon Sep 17 00:00:00 2001 From: Jairo Calmon Date: Thu, 18 Jun 2026 15:52:51 -0300 Subject: [PATCH 2/9] Gate card details on HAS_LOADED_APP instead of OpenCardDetailsPage --- src/ONYXKEYS.ts | 4 ---- src/libs/actions/Card.ts | 18 +-------------- .../Wallet/ExpensifyCardPage/index.tsx | 22 +++++++------------ 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 32bbc45e470c..67dd60ea1de0 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -406,9 +406,6 @@ const ONYXKEYS = { /** Set when we are loading the bulk change approver page */ IS_LOADING_BULK_CHANGE_APPROVER_PAGE: 'isLoadingBulkChangeApproverPage', - /** Set when we are fetching the card details for a single card from the server */ - IS_LOADING_CARD_DETAILS: 'isLoadingCardDetails', - /** Is report data loading? */ IS_LOADING_APP: 'isLoadingApp', @@ -1542,7 +1539,6 @@ type OnyxValuesMapping = { [ONYXKEYS.IS_LOADING_PAYMENT_METHODS]: boolean; [ONYXKEYS.IS_LOADING_SHARE_BANK_ACCOUNTS]: boolean; [ONYXKEYS.IS_LOADING_BULK_CHANGE_APPROVER_PAGE]: boolean; - [ONYXKEYS.IS_LOADING_CARD_DETAILS]: boolean; [ONYXKEYS.IS_LOADING_POLICY_CODING_RULES_PREVIEW]: boolean; [ONYXKEYS.IS_LOADING_REPORT_DATA]: boolean; [ONYXKEYS.IS_SEARCH_FILTERS_CARD_DATA_LOADED]: boolean; diff --git a/src/libs/actions/Card.ts b/src/libs/actions/Card.ts index bee934a3afd9..bfec860f560a 100644 --- a/src/libs/actions/Card.ts +++ b/src/libs/actions/Card.ts @@ -1563,23 +1563,7 @@ function openCardDetailsPage(cardID: number) { cardID, }; - const optimisticData: Array> = [ - { - onyxMethod: Onyx.METHOD.SET, - key: ONYXKEYS.IS_LOADING_CARD_DETAILS, - value: true, - }, - ]; - - const finallyData: Array> = [ - { - onyxMethod: Onyx.METHOD.SET, - key: ONYXKEYS.IS_LOADING_CARD_DETAILS, - value: false, - }, - ]; - - API.read(READ_COMMANDS.OPEN_CARD_DETAILS_PAGE, parameters, {optimisticData, finallyData}); + API.read(READ_COMMANDS.OPEN_CARD_DETAILS_PAGE, parameters); } type ContinuousReconciliationUpdate = OnyxUpdate< diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx index 9684887fb255..d4b4232d9c0c 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx @@ -1,5 +1,5 @@ import {useFocusEffect} from '@react-navigation/native'; -import React, {useCallback, useEffect, useMemo, useState} from 'react'; +import React, {useCallback, useMemo, useState} from 'react'; import type {ViewStyle} from 'react-native'; import {View} from 'react-native'; import type {OnyxCollection} from 'react-native-onyx'; @@ -29,7 +29,7 @@ import useNetwork from '@hooks/useNetwork'; import useNonPersonalCardList from '@hooks/useNonPersonalCardList'; import useOnyx from '@hooks/useOnyx'; import useThemeStyles from '@hooks/useThemeStyles'; -import {freezeCard, openCardDetailsPage, unfreezeCard} from '@libs/actions/Card'; +import {freezeCard, unfreezeCard} from '@libs/actions/Card'; import {resetValidateActionCodeSent} from '@libs/actions/User'; import navigateToCardTransactions from '@libs/CardNavigationUtils'; import { @@ -97,7 +97,7 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const [countryByIp] = useOnyx(ONYXKEYS.COUNTRY); const cardList = useNonPersonalCardList(); const [, cardListResult] = useOnyx(ONYXKEYS.CARD_LIST); - const [isLoadingCardDetailsFromServer] = useOnyx(ONYXKEYS.IS_LOADING_CARD_DETAILS); + const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP); const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${cardList?.[cardID]?.fundID}`); const styles = useThemeStyles(); const {isOffline} = useNetwork(); @@ -132,12 +132,6 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const revealedPIN = useRevealedPhysicalCardPin(String(currentPhysicalCard?.cardID)); const scaRevealedCardDetails = useAllRevealedVirtualCardDetails(); - // When opening this page directly (e.g. via a deep link from OldDot), the card may not be in CARD_LIST yet, so we - // fetch it from the server on mount. Until that fetch settles we show a loading indicator rather than the NotFoundPage. - useEffect(() => { - openCardDetailsPage(Number(cardID)); - }, [cardID]); - // Resets card details and revealed PIN when navigating away from the page. useFocusEffect( useCallback(() => { @@ -282,16 +276,16 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const navigateToTransactions = () => navigateToCardTransactions(cardID); - // The card details are fetched from the server on mount, so while CARD_LIST is still hydrating or that fetch is in - // flight we show the loading indicator instead of the NotFoundPage. When offline we cannot fetch, so we rely solely on - // whatever is already cached. - const isLoadingCardData = !currentCard && !isOffline && (isLoadingOnyxValue(cardListResult) || isLoadingCardDetailsFromServer !== false); + // The card data is loaded by the OpenApp request, so until the app has finished loading or CARD_LIST is still + // hydrating we show the loading indicator instead of the NotFoundPage. Otherwise, when opening this page directly + // (e.g. via a deep link from OldDot), the NotFoundPage briefly flashes before OpenApp populates CARD_LIST. + const isLoadingCardData = !currentCard && (!hasLoadedApp || isLoadingOnyxValue(cardListResult)); if (isLoadingCardData) { return ( ); } From aa86c87d1c9426894925285bf3e46e257a59b2aa Mon Sep 17 00:00:00 2001 From: Jairo Calmon Date: Fri, 19 Jun 2026 02:04:59 -0300 Subject: [PATCH 3/9] Replace FullScreenLoadingIndicator by ActivityIndicator --- .../Wallet/ExpensifyCardPage/index.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx index d4b4232d9c0c..12d2fbef92e0 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx @@ -5,13 +5,13 @@ import {View} from 'react-native'; import type {OnyxCollection} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import cardScarf from '@assets/images/card-scarf.svg'; +import ActivityIndicator from '@components/ActivityIndicator'; import AddToWalletButton from '@components/AddToWalletButton/index'; import Button from '@components/Button'; import CardPreview from '@components/CardPreview'; import ConfirmModal from '@components/ConfirmModal'; import DotIndicatorMessage from '@components/DotIndicatorMessage'; import FrozenCardHeader from '@components/FrozenCardHeader'; -import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import {useLockedAccountActions, useLockedAccountState} from '@components/LockedAccountModalProvider'; import MenuItem from '@components/MenuItem'; @@ -283,10 +283,18 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { if (isLoadingCardData) { return ( - + + Navigation.closeRHPFlow()} + /> + + + + ); } From d24b99f4abb26b09715098034df0df5e7aa40c48 Mon Sep 17 00:00:00 2001 From: Jairo Calmon Date: Sat, 20 Jun 2026 02:03:22 -0300 Subject: [PATCH 4/9] Fix Not Found page after reporting a card lost from OldDot Reporting an Expensify Card lost deletes the original card and issues a replacement with a new cardID. The card route the flow was launched from stayed in the RHP stack keyed on the now-deleted original card, so pressing back landed on it and rendered the NotFoundPage ("Not here"). Because the replacement's cardID also differs from the URL OldDot launched NewDot with, the HybridApp single-entry back handoff stopped firing, sending the user to the inbox instead of back to OldDot. The lost-card flow can be entered from two card routes that both render ExpensifyCardPage: the top-level DomainCard route (deep-linked from OldDot) and the Settings wallet card route (NewDot). Thread an isFromDomainCardDetail flag from the entry point through the flow so, on success, we collapse back onto the route the user actually came from (goBack with compareParams: false), replacing its cardID with the replacement card. This leaves a single valid card route whose back button returns to OldDot. Also normalize the cardID segment in ScreenWrapper's initial-URL match so the OldDot exit handoff still fires after the card is swapped for its replacement. --- src/ROUTES.ts | 6 ++++-- src/components/ScreenWrapper/index.tsx | 8 +++++++- src/libs/Navigation/types.ts | 6 ++++++ .../settings/Wallet/ExpensifyCardPage/index.tsx | 7 ++++++- .../Wallet/ReportCardLostConfirmMagicCodePage.tsx | 14 +++++++++++--- src/pages/settings/Wallet/ReportCardLostPage.tsx | 7 ++++--- .../settings/Wallet/SuccessReportCardLost.tsx | 10 ++++++++-- 7 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index ac8e4a090e64..6a447c479a17 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1316,11 +1316,13 @@ const ROUTES = { }, SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED: { route: 'settings/wallet/card/:cardID/report-card-lost-or-damaged', - getRoute: (cardID: string) => `settings/wallet/card/${cardID}/report-card-lost-or-damaged` as const, + getRoute: (cardID: string, isFromDomainCardDetail?: boolean) => + `settings/wallet/card/${cardID}/report-card-lost-or-damaged${isFromDomainCardDetail ? '?isFromDomainCardDetail=true' : ''}` as const, }, SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED_CONFIRM_MAGIC_CODE: { route: 'settings/wallet/card/:cardID/report-card-lost-or-damaged/:reason/confirm-magic-code', - getRoute: (cardID: string, reason: ReplacementReason) => `settings/wallet/card/${cardID}/report-card-lost-or-damaged/${reason}/confirm-magic-code` as const, + getRoute: (cardID: string, reason: ReplacementReason, isFromDomainCardDetail?: boolean) => + `settings/wallet/card/${cardID}/report-card-lost-or-damaged/${reason}/confirm-magic-code${isFromDomainCardDetail ? '?isFromDomainCardDetail=true' : ''}` as const, }, SETTINGS_WALLET_CARD_CHANGE_PIN: { route: 'settings/wallet/card/:cardID/change-pin', diff --git a/src/components/ScreenWrapper/index.tsx b/src/components/ScreenWrapper/index.tsx index 7d3e4d5da5bb..b1cc47bcb749 100644 --- a/src/components/ScreenWrapper/index.tsx +++ b/src/components/ScreenWrapper/index.tsx @@ -192,7 +192,13 @@ function ScreenWrapper({ Navigation.isNavigationReady().then(() => setInitialActiveRouteWithoutParams(Navigation.getActiveRouteWithoutParams())); }, []); const initialURLWithoutParams = initialURL?.replaceAll(/\?.*/g, ''); - const doesInitialURLMatchActiveRoute = !!initialURLWithoutParams?.endsWith(Navigation.getActiveRouteWithoutParams() || initialActiveRouteWithoutParams); + const activeRouteWithoutParams = Navigation.getActiveRouteWithoutParams() || initialActiveRouteWithoutParams; + // Reporting a card lost from a card deep-linked by OldDot (settings/card/:cardID) deletes the original card and lands the + // user on the replacement card's route. The cardID segment changes, so a plain endsWith comparison would no longer match the + // initial URL and the OldDot exit handoff below would not fire. Normalize the cardID segment so the same card-detail screen + // still counts as a match regardless of which card is shown. + const normalizeDomainCardDetailRoute = (path: string) => path.replace(/(^|\/)settings\/card\/[^/?]+/, '$1settings/card/:cardID'); + const doesInitialURLMatchActiveRoute = !!initialURLWithoutParams && normalizeDomainCardDetailRoute(initialURLWithoutParams).endsWith(normalizeDomainCardDetailRoute(activeRouteWithoutParams)); // A multifactor authentication flow (e.g. Face ID to reveal UK/EU card details) renders in an independent navigation tree // overlaid above the single NewDot entry, and each MFA screen renders its own ScreenWrapper. Navigation.getActiveRouteWithoutParams() diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 4a4452b00f9f..a7071ba523b7 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1222,6 +1222,9 @@ type SettingsNavigatorParamList = { [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: { /** cardID of selected card */ cardID: string; + + /** Whether the flow was launched from the top-level DomainCard route (deep-linked from OldDot) rather than the Settings wallet card route */ + isFromDomainCardDetail?: string; }; [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED_CONFIRM_MAGIC_CODE]: { /** cardID of selected card */ @@ -1229,6 +1232,9 @@ type SettingsNavigatorParamList = { /** Reason for replacing the card */ reason: ReplacementReason; + + /** Whether the flow was launched from the top-level DomainCard route (deep-linked from OldDot) rather than the Settings wallet card route */ + isFromDomainCardDetail?: string; }; [SCREENS.SETTINGS.DYNAMIC_KEYBOARD_SHORTCUTS]: undefined; [SCREENS.WORKSPACE.TAX_CREATE]: { diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx index 12d2fbef92e0..e3349222a5dd 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx @@ -632,7 +632,12 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { showLockedAccountModal(); return; } - Navigation.navigate(ROUTES.SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED.getRoute(String(currentPhysicalCard?.cardID))); + Navigation.navigate( + ROUTES.SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED.getRoute( + String(currentPhysicalCard?.cardID), + route.name === SCREENS.DOMAIN_CARD.DOMAIN_CARD_DETAIL, + ), + ); }} /> )} diff --git a/src/pages/settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx b/src/pages/settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx index 1be8cbd1ad33..6f923b4cf7dd 100644 --- a/src/pages/settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx +++ b/src/pages/settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx @@ -23,7 +23,7 @@ type ReportCardLostConfirmMagicCodePageProps = PlatformStackScreenProps Navigation.navigate(ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(newCardID))} + onBackButtonPress={() => + Navigation.goBack( + isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(newCardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(newCardID), + {compareParams: false}, + ) + } + /> + - ); } diff --git a/src/pages/settings/Wallet/ReportCardLostPage.tsx b/src/pages/settings/Wallet/ReportCardLostPage.tsx index 3824f857e49a..6be7eeedba6c 100644 --- a/src/pages/settings/Wallet/ReportCardLostPage.tsx +++ b/src/pages/settings/Wallet/ReportCardLostPage.tsx @@ -50,7 +50,7 @@ type ReportCardLostPageProps = PlatformStackScreenProps { @@ -117,7 +117,8 @@ function ReportCardLostPage({ return; } - Navigation.goBack(ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID)); + const cardDetailRoute = isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(cardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID); + Navigation.goBack(cardDetailRoute, {compareParams: false}); }; const isDamaged = reason?.key === OPTIONS_KEYS.DAMAGED; diff --git a/src/pages/settings/Wallet/SuccessReportCardLost.tsx b/src/pages/settings/Wallet/SuccessReportCardLost.tsx index 2bb8e5e78bea..e26303be44ea 100644 --- a/src/pages/settings/Wallet/SuccessReportCardLost.tsx +++ b/src/pages/settings/Wallet/SuccessReportCardLost.tsx @@ -7,7 +7,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import ROUTES from '@src/ROUTES'; -function SuccessReportCardLost({cardID}: {cardID: string}) { +function SuccessReportCardLost({cardID, isFromDomainCardDetail = false}: {cardID: string; isFromDomainCardDetail?: boolean}) { const {translate} = useLocalize(); const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); @@ -20,7 +20,13 @@ function SuccessReportCardLost({cardID}: {cardID: string}) { illustration={illustrations.CardReplacementSuccess} shouldShowButton onButtonPress={() => { - Navigation.navigate(ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID), {forceReplace: true}); + // Reporting a card lost deletes the original card and issues a replacement with a new cardID. The RHP stack still + // holds the card route for the now-deleted original card that the flow was launched from. Going back with + // compareParams: false collapses the flow onto that existing card route and replaces its cardID with the + // replacement card, leaving the user on a single valid card route whose back button returns to where the flow + // started (OldDot when launched from the top-level DomainCard route) instead of a stale/NotFound route. + const cardDetailRoute = isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(cardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID); + Navigation.goBack(cardDetailRoute, {compareParams: false}); }} buttonText={translate('common.buttonConfirm')} containerStyle={styles.h100} From f58bc393832aa71176f6f240d702dffeaa09adb3 Mon Sep 17 00:00:00 2001 From: Jairo Calmon Date: Sat, 20 Jun 2026 02:11:38 -0300 Subject: [PATCH 5/9] Normalize cardID when matching initial URL to active route Extract the initial-URL-vs-active-route check into doesInitialURLMatchActiveRoute and normalize the settings/card/:cardID segment, so the HybridApp single-entry back handoff still fires after a card is swapped for its replacement. --- src/components/ScreenWrapper/index.tsx | 13 +++------- .../helpers/doesInitialURLMatchActiveRoute.ts | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 src/libs/Navigation/helpers/doesInitialURLMatchActiveRoute.ts diff --git a/src/components/ScreenWrapper/index.tsx b/src/components/ScreenWrapper/index.tsx index b1cc47bcb749..fc31fbced0cf 100644 --- a/src/components/ScreenWrapper/index.tsx +++ b/src/components/ScreenWrapper/index.tsx @@ -24,6 +24,7 @@ import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import getPlatform from '@libs/getPlatform'; import mergeRefs from '@libs/mergeRefs'; import NarrowPaneContext from '@libs/Navigation/AppNavigator/Navigators/NarrowPaneContext'; +import doesInitialURLMatchActiveRoute from '@libs/Navigation/helpers/doesInitialURLMatchActiveRoute'; import Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackNavigationProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportsSplitNavigatorParamList, RightModalNavigatorParamList, RootNavigatorParamList} from '@libs/Navigation/types'; @@ -191,18 +192,12 @@ function ScreenWrapper({ useEffect(() => { Navigation.isNavigationReady().then(() => setInitialActiveRouteWithoutParams(Navigation.getActiveRouteWithoutParams())); }, []); - const initialURLWithoutParams = initialURL?.replaceAll(/\?.*/g, ''); const activeRouteWithoutParams = Navigation.getActiveRouteWithoutParams() || initialActiveRouteWithoutParams; - // Reporting a card lost from a card deep-linked by OldDot (settings/card/:cardID) deletes the original card and lands the - // user on the replacement card's route. The cardID segment changes, so a plain endsWith comparison would no longer match the - // initial URL and the OldDot exit handoff below would not fire. Normalize the cardID segment so the same card-detail screen - // still counts as a match regardless of which card is shown. - const normalizeDomainCardDetailRoute = (path: string) => path.replace(/(^|\/)settings\/card\/[^/?]+/, '$1settings/card/:cardID'); - const doesInitialURLMatchActiveRoute = !!initialURLWithoutParams && normalizeDomainCardDetailRoute(initialURLWithoutParams).endsWith(normalizeDomainCardDetailRoute(activeRouteWithoutParams)); + const initialURLMatchesActiveRoute = doesInitialURLMatchActiveRoute(initialURL, activeRouteWithoutParams); // A multifactor authentication flow (e.g. Face ID to reveal UK/EU card details) renders in an independent navigation tree // overlaid above the single NewDot entry, and each MFA screen renders its own ScreenWrapper. Navigation.getActiveRouteWithoutParams() - // still reports the underlying NewDot route while the overlay is up, so doesInitialURLMatchActiveRoute is true on the MFA screens too. + // still reports the underlying NewDot route while the overlay is up, so initialURLMatchesActiveRoute is true on the MFA screens too. // usePreventRemove calls e.preventDefault() unconditionally whenever the guard is active, so guarding these instances would consume the // MFA navigator's own stack actions (e.g. replacing the magic-code page with the Face ID prompt, or popping the outcome screen on close), // blocking transitions within the flow. Guard only the outer NewDot ScreenWrapper, never the ScreenWrappers inside the MFA overlay. @@ -210,7 +205,7 @@ function ScreenWrapper({ const route = useContext(NavigationRouteContext ?? FallbackRouteContext); const isMfaOverlayScreen = !!route && MFA_OVERLAY_SCREENS.has(route.name); - usePreventRemove(isSingleNewDotEntry && doesInitialURLMatchActiveRoute && !shouldBlockSingleEntryOldAppExit && !isMfaOverlayScreen, () => { + usePreventRemove(isSingleNewDotEntry && initialURLMatchesActiveRoute && !shouldBlockSingleEntryOldAppExit && !isMfaOverlayScreen, () => { if (!CONFIG.IS_HYBRID_APP) { return; } diff --git a/src/libs/Navigation/helpers/doesInitialURLMatchActiveRoute.ts b/src/libs/Navigation/helpers/doesInitialURLMatchActiveRoute.ts new file mode 100644 index 000000000000..25f395e54aff --- /dev/null +++ b/src/libs/Navigation/helpers/doesInitialURLMatchActiveRoute.ts @@ -0,0 +1,26 @@ +import type {Route} from '@src/ROUTES'; + +/** + * Reporting a card lost from a card deep-linked by OldDot (settings/card/:cardID) deletes the original card and lands the + * user on the replacement card's route. The cardID segment changes, so a plain comparison would no longer match the initial + * URL. Normalize the cardID segment so the same card-detail screen still counts as a match regardless of which card is shown. + */ +function normalizeDomainCardDetailRoute(path: string): string { + return path.replace(/(^|\/)settings\/card\/[^/?]+/, '$1settings/card/:cardID'); +} + +/** + * Whether the initial URL that launched NewDot still matches the currently active route. Used to decide whether the + * HybridApp single-entry back handoff should fire (i.e. the user is still on the screen OldDot deep-linked into). + */ +function doesInitialURLMatchActiveRoute(initialURL: Route | null, activeRouteWithoutParams: string): boolean { + const initialURLWithoutParams = initialURL?.replaceAll(/\?.*/g, ''); + + if (!initialURLWithoutParams) { + return false; + } + + return normalizeDomainCardDetailRoute(initialURLWithoutParams).endsWith(normalizeDomainCardDetailRoute(activeRouteWithoutParams)); +} + +export default doesInitialURLMatchActiveRoute; From e83bbce422853db4a1a6bf91ea5949d342a231f8 Mon Sep 17 00:00:00 2001 From: Jairo Calmon Date: Sat, 20 Jun 2026 05:36:01 -0300 Subject: [PATCH 6/9] Wait on IS_LOADING_APP to prevent NotFoundPage flash on card details hasLoadedApp is a one-shot flag that never resets, so on a warm app it can't represent a later OpenApp bringing in a card missing from CARD_LIST (e.g. a freshly issued replacement or a card deep-linked from OldDot), causing the NotFoundPage to show prematurely. Also wait on the live IS_LOADING_APP signal so the loading indicator stays up while an OpenApp/reconnect is in flight, and fall back to NotFoundPage only once it settles without the card. --- .../settings/Wallet/ExpensifyCardPage/index.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx index e3349222a5dd..ede0bd662c4f 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx @@ -98,6 +98,7 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const cardList = useNonPersonalCardList(); const [, cardListResult] = useOnyx(ONYXKEYS.CARD_LIST); const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP); + const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP); const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${cardList?.[cardID]?.fundID}`); const styles = useThemeStyles(); const {isOffline} = useNetwork(); @@ -276,10 +277,13 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const navigateToTransactions = () => navigateToCardTransactions(cardID); - // The card data is loaded by the OpenApp request, so until the app has finished loading or CARD_LIST is still - // hydrating we show the loading indicator instead of the NotFoundPage. Otherwise, when opening this page directly - // (e.g. via a deep link from OldDot), the NotFoundPage briefly flashes before OpenApp populates CARD_LIST. - const isLoadingCardData = !currentCard && (!hasLoadedApp || isLoadingOnyxValue(cardListResult)); + // The card data is loaded by the OpenApp request. We show the loading indicator instead of the NotFoundPage while the card + // could still arrive: before the app has loaded for the first time (hasLoadedApp), while an OpenApp/reconnect is in flight + // (isLoadingApp), or while CARD_LIST is still hydrating. hasLoadedApp is a one-shot flag that never resets, so on a warm app + // it can't represent a later OpenApp that brings in a card missing from CARD_LIST (e.g. a freshly issued replacement card or + // a card deep-linked from OldDot); isLoadingApp covers those in-flight refreshes so the NotFoundPage doesn't flash before + // the card lands. Once all of these settle and the card is still absent, the NotFoundPage is the correct terminal state. + const isLoadingCardData = !currentCard && (!hasLoadedApp || isLoadingApp || isLoadingOnyxValue(cardListResult)); if (isLoadingCardData) { return ( @@ -291,7 +295,7 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { From b5a4d55f37641acef350b5e79f7d8e3d73983062 Mon Sep 17 00:00:00 2001 From: Jairo Calmon Date: Sat, 20 Jun 2026 06:25:50 -0300 Subject: [PATCH 7/9] Lint code --- src/pages/settings/Wallet/ExpensifyCardPage/index.tsx | 2 +- .../settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx index ede0bd662c4f..eea878f8e5c1 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx @@ -283,7 +283,7 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { // it can't represent a later OpenApp that brings in a card missing from CARD_LIST (e.g. a freshly issued replacement card or // a card deep-linked from OldDot); isLoadingApp covers those in-flight refreshes so the NotFoundPage doesn't flash before // the card lands. Once all of these settle and the card is still absent, the NotFoundPage is the correct terminal state. - const isLoadingCardData = !currentCard && (!hasLoadedApp || isLoadingApp || isLoadingOnyxValue(cardListResult)); + const isLoadingCardData = !currentCard && (!hasLoadedApp || !!isLoadingApp || isLoadingOnyxValue(cardListResult)); if (isLoadingCardData) { return ( diff --git a/src/pages/settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx b/src/pages/settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx index 6f923b4cf7dd..4f1234e8573c 100644 --- a/src/pages/settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx +++ b/src/pages/settings/Wallet/ReportCardLostConfirmMagicCodePage.tsx @@ -66,10 +66,9 @@ function ReportCardLostConfirmMagicCodePage({ - Navigation.goBack( - isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(newCardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(newCardID), - {compareParams: false}, - ) + Navigation.goBack(isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(newCardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(newCardID), { + compareParams: false, + }) } /> Date: Sat, 20 Jun 2026 07:03:47 -0300 Subject: [PATCH 8/9] Fix duplicate card details and 404 after activating a card from OldDot Activating a physical card navigated (pushed) to SETTINGS_WALLET_DOMAIN_CARD on success, creating a duplicate card details screen and, when launched from the OldDot domain card, leaving the original top-level DomainCard route stale beneath. Thread an isFromDomainCardDetail flag through the activate flow and collapse back onto the originating card route (goBack with compareParams: false), picking the DomainCard vs Settings wallet card route based on origin. --- src/ROUTES.ts | 2 +- src/libs/Navigation/types.ts | 3 +++ .../Wallet/ActivatePhysicalCardPage.tsx | 9 +++++++-- .../Wallet/ActivatePhysicalCardPageBase.tsx | 19 ++++++++++++++----- .../Wallet/ExpensifyCardPage/index.tsx | 4 +++- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 6a447c479a17..ddc73099eea9 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1334,7 +1334,7 @@ const ROUTES = { }, SETTINGS_WALLET_CARD_ACTIVATE: { route: 'settings/wallet/card/:cardID/activate', - getRoute: (cardID: string) => `settings/wallet/card/${cardID}/activate` as const, + getRoute: (cardID: string, isFromDomainCardDetail?: boolean) => `settings/wallet/card/${cardID}/activate${isFromDomainCardDetail ? '?isFromDomainCardDetail=true' : ''}` as const, }, SETTINGS_WALLET_TRAVEL_CVV: 'settings/wallet/travel-cvv', SETTINGS_WALLET_TRAVEL_CVV_VERIFY_ACCOUNT: `settings/wallet/travel-cvv/${VERIFY_ACCOUNT}`, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index a7071ba523b7..3bfbbf77250e 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -177,6 +177,9 @@ type SettingsNavigatorParamList = { [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: { /** cardID of selected card */ cardID: string; + + /** Whether the flow was launched from the top-level DomainCard route (deep-linked from OldDot) rather than the Settings wallet card route */ + isFromDomainCardDetail?: string; }; [SCREENS.SETTINGS.WALLET.CARD_CHANGE_PIN]: { /** cardID of selected card */ diff --git a/src/pages/settings/Wallet/ActivatePhysicalCardPage.tsx b/src/pages/settings/Wallet/ActivatePhysicalCardPage.tsx index 046bef1b7541..b548970a31ab 100644 --- a/src/pages/settings/Wallet/ActivatePhysicalCardPage.tsx +++ b/src/pages/settings/Wallet/ActivatePhysicalCardPage.tsx @@ -8,10 +8,15 @@ type ActivatePhysicalCardPageProps = PlatformStackScreenProps; + return ( + + ); } export default ActivatePhysicalCardPage; diff --git a/src/pages/settings/Wallet/ActivatePhysicalCardPageBase.tsx b/src/pages/settings/Wallet/ActivatePhysicalCardPageBase.tsx index 12957042e411..e9dcd5a9ca72 100644 --- a/src/pages/settings/Wallet/ActivatePhysicalCardPageBase.tsx +++ b/src/pages/settings/Wallet/ActivatePhysicalCardPageBase.tsx @@ -26,11 +26,14 @@ import {getEmptyObject, isEmptyObject} from '@src/types/utils/EmptyObject'; type ActivatePhysicalCardPageBaseProps = { cardID?: string; navigateBackTo?: Route; + + /** Whether the flow was launched from the top-level DomainCard route (deep-linked from OldDot) rather than the Settings wallet card route */ + isFromDomainCardDetail?: boolean; }; const LAST_FOUR_DIGITS_LENGTH = 4; -function ActivatePhysicalCardPageBase({cardID = '', navigateBackTo}: ActivatePhysicalCardPageBaseProps) { +function ActivatePhysicalCardPageBase({cardID = '', navigateBackTo, isFromDomainCardDetail = false}: ActivatePhysicalCardPageBaseProps) { const theme = useTheme(); const styles = useThemeStyles(); const {isExtraSmallScreenHeight} = useResponsiveLayout(); @@ -48,15 +51,19 @@ function ActivatePhysicalCardPageBase({cardID = '', navigateBackTo}: ActivatePhy const activateCardCodeInputRef = useRef(null); /** - * If state of the card is CONST.EXPENSIFY_CARD.STATE.OPEN, navigate to card details screen. + * If state of the card is CONST.EXPENSIFY_CARD.STATE.OPEN, return to the card details screen. */ useEffect(() => { if (inactiveCard?.state !== CONST.EXPENSIFY_CARD.STATE.OPEN || inactiveCard?.isLoading) { return; } - Navigation.navigate(ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID)); - }, [cardID, cardList, inactiveCard?.isLoading, inactiveCard?.state]); + // Collapse the activate flow back onto the existing card route instead of pushing a new one, so the user is not left + // with a duplicate card details screen and a stale route to back through. The card route is the top-level DomainCard + // route when the flow was deep-linked from OldDot, otherwise the Settings wallet card route. + const cardDetailRoute = isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(cardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID); + Navigation.goBack(cardDetailRoute, {compareParams: false}); + }, [cardID, cardList, inactiveCard?.isLoading, inactiveCard?.state, isFromDomainCardDetail]); useEffect(() => { if (!inactiveCard?.cardID) { @@ -100,7 +107,9 @@ function ActivatePhysicalCardPageBase({cardID = '', navigateBackTo}: ActivatePhy return ( Navigation.goBack(navigateBackTo ?? ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID))} + onBackButtonPress={() => + Navigation.goBack(navigateBackTo ?? (isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(cardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID))) + } backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PREFERENCES.ROOT].backgroundColor} illustration={LottieAnimations.Magician} scrollViewContainerStyles={[styles.mnh100]} diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx index eea878f8e5c1..4fad29c0813d 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx @@ -673,7 +673,9 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { success large style={[styles.w100, styles.p5]} - onPress={() => Navigation.navigate(ROUTES.SETTINGS_WALLET_CARD_ACTIVATE.getRoute(String(currentPhysicalCard?.cardID)))} + onPress={() => + Navigation.navigate(ROUTES.SETTINGS_WALLET_CARD_ACTIVATE.getRoute(String(currentPhysicalCard?.cardID), route.name === SCREENS.DOMAIN_CARD.DOMAIN_CARD_DETAIL)) + } text={translate('activateCardPage.activatePhysicalCard')} /> )} From a43f78712061c0453ff02e7bdb62da7b412b96d3 Mon Sep 17 00:00:00 2001 From: Jairo Calmon Date: Mon, 22 Jun 2026 17:15:12 -0300 Subject: [PATCH 9/9] Make comments more concise --- .../settings/Wallet/ActivatePhysicalCardPageBase.tsx | 3 +-- src/pages/settings/Wallet/ExpensifyCardPage/index.tsx | 8 ++------ src/pages/settings/Wallet/SuccessReportCardLost.tsx | 7 ++----- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/pages/settings/Wallet/ActivatePhysicalCardPageBase.tsx b/src/pages/settings/Wallet/ActivatePhysicalCardPageBase.tsx index e9dcd5a9ca72..cb568d06a3ed 100644 --- a/src/pages/settings/Wallet/ActivatePhysicalCardPageBase.tsx +++ b/src/pages/settings/Wallet/ActivatePhysicalCardPageBase.tsx @@ -59,8 +59,7 @@ function ActivatePhysicalCardPageBase({cardID = '', navigateBackTo, isFromDomain } // Collapse the activate flow back onto the existing card route instead of pushing a new one, so the user is not left - // with a duplicate card details screen and a stale route to back through. The card route is the top-level DomainCard - // route when the flow was deep-linked from OldDot, otherwise the Settings wallet card route. + // with a duplicate card details screen and a stale route to back through. const cardDetailRoute = isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(cardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID); Navigation.goBack(cardDetailRoute, {compareParams: false}); }, [cardID, cardList, inactiveCard?.isLoading, inactiveCard?.state, isFromDomainCardDetail]); diff --git a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx index 4fad29c0813d..538c6eb33c3f 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx +++ b/src/pages/settings/Wallet/ExpensifyCardPage/index.tsx @@ -277,12 +277,8 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) { const navigateToTransactions = () => navigateToCardTransactions(cardID); - // The card data is loaded by the OpenApp request. We show the loading indicator instead of the NotFoundPage while the card - // could still arrive: before the app has loaded for the first time (hasLoadedApp), while an OpenApp/reconnect is in flight - // (isLoadingApp), or while CARD_LIST is still hydrating. hasLoadedApp is a one-shot flag that never resets, so on a warm app - // it can't represent a later OpenApp that brings in a card missing from CARD_LIST (e.g. a freshly issued replacement card or - // a card deep-linked from OldDot); isLoadingApp covers those in-flight refreshes so the NotFoundPage doesn't flash before - // the card lands. Once all of these settle and the card is still absent, the NotFoundPage is the correct terminal state. + // Show the loading indicator instead of the NotFoundPage while the card could still arrive: Before the app has loaded for the first time (hasLoadedApp), + // while an OpenApp/reconnect is in flight (isLoadingApp), or while CARD_LIST is still hydrating. const isLoadingCardData = !currentCard && (!hasLoadedApp || !!isLoadingApp || isLoadingOnyxValue(cardListResult)); if (isLoadingCardData) { diff --git a/src/pages/settings/Wallet/SuccessReportCardLost.tsx b/src/pages/settings/Wallet/SuccessReportCardLost.tsx index e26303be44ea..e4f0fc29635b 100644 --- a/src/pages/settings/Wallet/SuccessReportCardLost.tsx +++ b/src/pages/settings/Wallet/SuccessReportCardLost.tsx @@ -20,11 +20,8 @@ function SuccessReportCardLost({cardID, isFromDomainCardDetail = false}: {cardID illustration={illustrations.CardReplacementSuccess} shouldShowButton onButtonPress={() => { - // Reporting a card lost deletes the original card and issues a replacement with a new cardID. The RHP stack still - // holds the card route for the now-deleted original card that the flow was launched from. Going back with - // compareParams: false collapses the flow onto that existing card route and replaces its cardID with the - // replacement card, leaving the user on a single valid card route whose back button returns to where the flow - // started (OldDot when launched from the top-level DomainCard route) instead of a stale/NotFound route. + // Going back with compareParams: false collapses the flow onto the deleted card route and + // replaces its cardID with the replacement card instead of a stale/NotFound route. const cardDetailRoute = isFromDomainCardDetail ? ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(cardID) : ROUTES.SETTINGS_WALLET_DOMAIN_CARD.getRoute(cardID); Navigation.goBack(cardDetailRoute, {compareParams: false}); }}