From f3c0727aadcdb304cb560ae4a08b05578374eddb Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Tue, 14 Oct 2025 16:51:35 +0200 Subject: [PATCH 01/10] Hide loading bar on top bar when rhp is visible --- src/components/Navigation/TopBar.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Navigation/TopBar.tsx b/src/components/Navigation/TopBar.tsx index 84eb0a5a8c6e..d2d4b94cd1d7 100644 --- a/src/components/Navigation/TopBar.tsx +++ b/src/components/Navigation/TopBar.tsx @@ -9,9 +9,11 @@ import Text from '@components/Text'; import useLoadingBarVisibility from '@hooks/useLoadingBarVisibility'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; +import useRootNavigationState from '@hooks/useRootNavigationState'; import useThemeStyles from '@hooks/useThemeStyles'; import SignInButton from '@pages/home/sidebar/SignInButton'; import {isAnonymousUser as isAnonymousUserUtil} from '@userActions/Session'; +import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Session} from '@src/types/onyx'; @@ -32,6 +34,7 @@ function TopBar({breadcrumbLabel, shouldDisplaySearch = true, shouldDisplayHelpB const [session] = useOnyx(ONYXKEYS.SESSION, {selector: authTokenTypeSelector, canBeMissing: true}); const shouldShowLoadingBarForReports = useLoadingBarVisibility(); const isAnonymousUser = isAnonymousUserUtil(session); + const isRhpVisible = useRootNavigationState((state) => state?.routes?.at(-1)?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR); const displaySignIn = isAnonymousUser; const displaySearch = !isAnonymousUser && shouldDisplaySearch; @@ -68,7 +71,7 @@ function TopBar({breadcrumbLabel, shouldDisplaySearch = true, shouldDisplayHelpB {shouldDisplayHelpButton && } {displaySearch && } - + ); } From 00a128cb45c6ae82d8d7a54c8db5cc9eec543b43 Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Tue, 14 Oct 2025 16:51:59 +0200 Subject: [PATCH 02/10] Preload SearchReport before opening --- src/components/Search/index.tsx | 3 ++- .../Search/openSearchReport/index.native.ts | 6 ++++++ src/components/Search/openSearchReport/index.ts | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/components/Search/openSearchReport/index.native.ts create mode 100644 src/components/Search/openSearchReport/index.ts diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index eb9aa36c1969..d243c5486c51 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -71,6 +71,7 @@ import type {SearchTransaction} from '@src/types/onyx/SearchResults'; import type {TransactionViolation} from '@src/types/onyx/TransactionViolation'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import arraysEqual from '@src/utils/arraysEqual'; +import openSearchReport from './openSearchReport'; import {useSearchContext} from './SearchContext'; import SearchList from './SearchList'; import {SearchScopeProvider} from './SearchScopeProvider'; @@ -712,7 +713,7 @@ function Search({ setOptimisticDataForTransactionThreadPreview(item, transactionPreviewData); } - requestAnimationFrame(() => Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID, backTo}))); + openSearchReport(reportID, backTo); }, [isMobileSelectionModeEnabled, type, toggleTransaction, hash, queryJSON, handleSearch, searchKey, markReportIDAsExpense], ); diff --git a/src/components/Search/openSearchReport/index.native.ts b/src/components/Search/openSearchReport/index.native.ts new file mode 100644 index 000000000000..46a4d63f8cf3 --- /dev/null +++ b/src/components/Search/openSearchReport/index.native.ts @@ -0,0 +1,6 @@ +import Navigation from '@libs/Navigation/Navigation'; +import ROUTES from '@src/ROUTES'; + +export default function openSearchReport(reportID: string, backTo: string) { + requestAnimationFrame(() => Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID, backTo}))); +} diff --git a/src/components/Search/openSearchReport/index.ts b/src/components/Search/openSearchReport/index.ts new file mode 100644 index 000000000000..3c85a5dd91f5 --- /dev/null +++ b/src/components/Search/openSearchReport/index.ts @@ -0,0 +1,16 @@ +import {CommonActions} from '@react-navigation/native'; +import Navigation, {navigationRef} from '@libs/Navigation/Navigation'; +import NAVIGATORS from '@src/NAVIGATORS'; +import ROUTES from '@src/ROUTES'; +import SCREENS from '@src/SCREENS'; + +export default function openSearchReport(reportID: string, backTo: string) { + navigationRef.dispatch({ + ...CommonActions.preload(NAVIGATORS.RIGHT_MODAL_NAVIGATOR, { + name: SCREENS.RIGHT_MODAL.SEARCH_REPORT, + params: {reportID, backTo}, + }), + target: navigationRef.getRootState().key, + }); + requestAnimationFrame(() => Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID, backTo}))); +} From fd68c30dd536920f556af984f64b3bb27b0498ee Mon Sep 17 00:00:00 2001 From: Yehor Kharchenko Date: Mon, 27 Oct 2025 14:40:11 +0100 Subject: [PATCH 03/10] fixed loading bar on other rhps beside wide rhp --- src/components/Navigation/TopBar.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Navigation/TopBar.tsx b/src/components/Navigation/TopBar.tsx index d2d4b94cd1d7..fa8118f494f3 100644 --- a/src/components/Navigation/TopBar.tsx +++ b/src/components/Navigation/TopBar.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useContext} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import LoadingBar from '@components/LoadingBar'; @@ -6,14 +6,13 @@ import {PressableWithoutFeedback} from '@components/Pressable'; import SearchButton from '@components/Search/SearchRouter/SearchButton'; import HelpButton from '@components/SidePanel/HelpComponents/HelpButton'; import Text from '@components/Text'; +import {WideRHPContext} from '@components/WideRHPContextProvider'; import useLoadingBarVisibility from '@hooks/useLoadingBarVisibility'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; -import useRootNavigationState from '@hooks/useRootNavigationState'; import useThemeStyles from '@hooks/useThemeStyles'; import SignInButton from '@pages/home/sidebar/SignInButton'; import {isAnonymousUser as isAnonymousUserUtil} from '@userActions/Session'; -import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Session} from '@src/types/onyx'; @@ -34,7 +33,8 @@ function TopBar({breadcrumbLabel, shouldDisplaySearch = true, shouldDisplayHelpB const [session] = useOnyx(ONYXKEYS.SESSION, {selector: authTokenTypeSelector, canBeMissing: true}); const shouldShowLoadingBarForReports = useLoadingBarVisibility(); const isAnonymousUser = isAnonymousUserUtil(session); - const isRhpVisible = useRootNavigationState((state) => state?.routes?.at(-1)?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR); + const {wideRHPRouteKeys} = useContext(WideRHPContext); + const isWideRhpVisible = !!wideRHPRouteKeys.length; const displaySignIn = isAnonymousUser; const displaySearch = !isAnonymousUser && shouldDisplaySearch; @@ -71,7 +71,7 @@ function TopBar({breadcrumbLabel, shouldDisplaySearch = true, shouldDisplayHelpB {shouldDisplayHelpButton && } {displaySearch && } - + ); } From dc0bad4f261892ced23aa37c3350fc58f65af3ae Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Mon, 27 Oct 2025 15:41:46 +0100 Subject: [PATCH 04/10] Add comment to openSearchReport --- src/components/Search/openSearchReport/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Search/openSearchReport/index.ts b/src/components/Search/openSearchReport/index.ts index 3c85a5dd91f5..05e06c549799 100644 --- a/src/components/Search/openSearchReport/index.ts +++ b/src/components/Search/openSearchReport/index.ts @@ -4,6 +4,7 @@ import NAVIGATORS from '@src/NAVIGATORS'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; +// The search report screen is preloaded before navigating to avoid lag when opening the page. If the content is rendered in the background and then navigated, the opening experience is smoother. export default function openSearchReport(reportID: string, backTo: string) { navigationRef.dispatch({ ...CommonActions.preload(NAVIGATORS.RIGHT_MODAL_NAVIGATOR, { From d1dfb68e94b08ed6ad82f0c70f6641cc3a44e30a Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Mon, 27 Oct 2025 15:54:40 +0100 Subject: [PATCH 05/10] Adjust navigating to search report after creating transaction thread --- src/components/Search/openSearchReport/index.native.ts | 2 +- src/components/Search/openSearchReport/index.ts | 2 +- src/libs/SearchUIUtils.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Search/openSearchReport/index.native.ts b/src/components/Search/openSearchReport/index.native.ts index 46a4d63f8cf3..4929d1a49257 100644 --- a/src/components/Search/openSearchReport/index.native.ts +++ b/src/components/Search/openSearchReport/index.native.ts @@ -1,6 +1,6 @@ import Navigation from '@libs/Navigation/Navigation'; import ROUTES from '@src/ROUTES'; -export default function openSearchReport(reportID: string, backTo: string) { +export default function openSearchReport(reportID: string | undefined, backTo: string) { requestAnimationFrame(() => Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID, backTo}))); } diff --git a/src/components/Search/openSearchReport/index.ts b/src/components/Search/openSearchReport/index.ts index 05e06c549799..3b6cf0179977 100644 --- a/src/components/Search/openSearchReport/index.ts +++ b/src/components/Search/openSearchReport/index.ts @@ -5,7 +5,7 @@ import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; // The search report screen is preloaded before navigating to avoid lag when opening the page. If the content is rendered in the background and then navigated, the opening experience is smoother. -export default function openSearchReport(reportID: string, backTo: string) { +export default function openSearchReport(reportID: string | undefined, backTo: string) { navigationRef.dispatch({ ...CommonActions.preload(NAVIGATORS.RIGHT_MODAL_NAVIGATOR, { name: SCREENS.RIGHT_MODAL.SEARCH_REPORT, diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 313e5302777f..c12072d12e5a 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -7,6 +7,7 @@ import type DotLottieAnimation from '@components/LottieAnimations/types'; import type {MenuItemWithLink} from '@components/MenuItemList'; import type {MultiSelectItem} from '@components/Search/FilterDropdowns/MultiSelectPopup'; import type {SingleSelectItem} from '@components/Search/FilterDropdowns/SingleSelectPopup'; +import openSearchReport from '@components/Search/openSearchReport'; import type { SearchAction, SearchColumnType, @@ -1343,7 +1344,7 @@ function createAndOpenSearchTransactionThread(item: TransactionListItemType, has } if (shouldNavigate) { - Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: transactionThreadReport?.reportID, backTo})); + openSearchReport(transactionThreadReport?.reportID, backTo); } } From 972a65c8e3a4d04611ffd56bff3081ac32bd2582 Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Mon, 27 Oct 2025 16:44:05 +0100 Subject: [PATCH 06/10] Adjust SearchUIUtilsTest tests --- tests/unit/Search/SearchUIUtilsTest.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index ac12e3d2a5a4..59c9f1c766bb 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -1,5 +1,6 @@ import type {OnyxCollection} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; +import openSearchReport from '@components/Search/openSearchReport'; import ChatListItem from '@components/SelectionListWithSections/ChatListItem'; import TransactionGroupListItem from '@components/SelectionListWithSections/Search/TransactionGroupListItem'; import TransactionListItem from '@components/SelectionListWithSections/Search/TransactionListItem'; @@ -12,7 +13,6 @@ import type { TransactionReportGroupListItemType, TransactionWithdrawalIDGroupListItemType, } from '@components/SelectionListWithSections/types'; -import Navigation from '@navigation/Navigation'; // eslint-disable-next-line no-restricted-syntax import type * as ReportUserActions from '@userActions/Report'; import {createTransactionThreadReport} from '@userActions/Report'; @@ -25,7 +25,6 @@ import IntlStore from '@src/languages/IntlStore'; import type {CardFeedForDisplay} from '@src/libs/CardFeedUtils'; import * as SearchUIUtils from '@src/libs/SearchUIUtils'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; import type {Connections} from '@src/types/onyx/Policy'; import type {SearchDataTypes} from '@src/types/onyx/SearchResults'; @@ -45,6 +44,7 @@ jest.mock('@userActions/Search', () => ({ ...jest.requireActual('@userActions/Search'), updateSearchResultsWithTransactionThreadReportID: jest.fn(), })); +jest.mock('@components/Search/openSearchReport', () => jest.fn()); const adminAccountID = 18439984; const adminEmail = 'admin@policy.com'; @@ -2876,12 +2876,12 @@ describe('SearchUIUtils', () => { test('Should not navigate if shouldNavigate = false', () => { SearchUIUtils.createAndOpenSearchTransactionThread(transactionListItem, hash, backTo, undefined, false); - expect(Navigation.navigate).not.toHaveBeenCalled(); + expect(openSearchReport).not.toHaveBeenCalled(); }); test('Should handle navigation if shouldNavigate = true', () => { SearchUIUtils.createAndOpenSearchTransactionThread(transactionListItem, hash, backTo, undefined, true); - expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.SEARCH_REPORT.getRoute({reportID: threadReportID, backTo})); + expect(openSearchReport).toHaveBeenCalledWith(threadReportID, backTo); }); }); From d0cb97b1e15927d9427dad92744748fb38eaa95d Mon Sep 17 00:00:00 2001 From: Yehor Kharchenko Date: Tue, 28 Oct 2025 10:38:33 +0100 Subject: [PATCH 07/10] adjust navigating to wide rhp in transactions list --- .../MoneyRequestReportTransactionList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx index af8b31c5608a..280e1ef35d45 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx @@ -10,6 +10,7 @@ import MenuItem from '@components/MenuItem'; import Modal from '@components/Modal'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; import {usePersonalDetails} from '@components/OnyxListItemProvider'; +import openSearchReport from '@components/Search/openSearchReport'; import {useSearchContext} from '@components/Search/SearchContext'; import type {SearchColumnType, SortOrder} from '@components/Search/types'; import Text from '@components/Text'; @@ -49,7 +50,6 @@ import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import MoneyRequestReportTableHeader from './MoneyRequestReportTableHeader'; @@ -266,7 +266,7 @@ function MoneyRequestReportTransactionList({ if (reportIDToNavigate) { markReportIDAsExpense(reportIDToNavigate); } - Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute(routeParams)); + openSearchReport(routeParams.reportID, backTo); }); }, [report, reportActions, sortedTransactions, markReportIDAsExpense], From 37a41c79a5a6eea33f928f83ffc58e2b523fbeea Mon Sep 17 00:00:00 2001 From: Yehor Kharchenko Date: Tue, 28 Oct 2025 14:55:57 +0100 Subject: [PATCH 08/10] removed lastVisibleRHPRouteKey from dependency array to prevent immidiate recalculation after closing RHP, it should be recalculated after closing animation --- src/components/WideRHPContextProvider/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/WideRHPContextProvider/index.tsx b/src/components/WideRHPContextProvider/index.tsx index 17410a4520e6..87f5ee90ae7f 100644 --- a/src/components/WideRHPContextProvider/index.tsx +++ b/src/components/WideRHPContextProvider/index.tsx @@ -115,7 +115,11 @@ function WideRHPContextProvider({children}: React.PropsWithChildren) { const currentKeys = allWideRHPRouteKeys.filter((key) => lastRHPKeys.has(key)); return currentKeys; - }, [allWideRHPRouteKeys, lastVisibleRHPRouteKey]); + // We intentionally exclude lastVisibleRHPRouteKey from dependencies to prevent immediate + // recalculation when RHP closes, allowing smooth closing animations to complete + // eslint-disable-next-line react-compiler/react-compiler + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [allWideRHPRouteKeys]); /** * Determines whether the secondary overlay should be displayed. From 14a901f8a6412d3c83949e8ab86d43f1da917f7b Mon Sep 17 00:00:00 2001 From: Yehor Kharchenko Date: Wed, 29 Oct 2025 13:44:11 +0100 Subject: [PATCH 09/10] fixed widerhp initialization after efresh to have widerhp size instead of classic rhp --- src/components/WideRHPContextProvider/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/WideRHPContextProvider/index.tsx b/src/components/WideRHPContextProvider/index.tsx index 87f5ee90ae7f..9a203d6b584c 100644 --- a/src/components/WideRHPContextProvider/index.tsx +++ b/src/components/WideRHPContextProvider/index.tsx @@ -80,6 +80,7 @@ function WideRHPContextProvider({children}: React.PropsWithChildren) { const [allWideRHPRouteKeys, setAllWideRHPRouteKeys] = useState([]); const [shouldRenderSecondaryOverlay, setShouldRenderSecondaryOverlay] = useState(false); const [expenseReportIDs, setExpenseReportIDs] = useState>(new Set()); + const [navigationUpdateTrigger, setNavigationUpdateTrigger] = useState(false); // Return undefined if RHP is not the last route const lastVisibleRHPRouteKey = useRootNavigationState((state) => { @@ -95,6 +96,9 @@ function WideRHPContextProvider({children}: React.PropsWithChildren) { return undefined; } + // Trigger recalculation of wideRHPRouteKeys after navigation initialization + // This ensures proper wide RHP display on page reload or deep links when lastVisibleRHPRouteKey becomes available + setNavigationUpdateTrigger(true); return state?.routes.at(lastRHPRouteIndex)?.key; }); @@ -119,7 +123,7 @@ function WideRHPContextProvider({children}: React.PropsWithChildren) { // recalculation when RHP closes, allowing smooth closing animations to complete // eslint-disable-next-line react-compiler/react-compiler // eslint-disable-next-line react-hooks/exhaustive-deps - }, [allWideRHPRouteKeys]); + }, [allWideRHPRouteKeys, navigationUpdateTrigger]); /** * Determines whether the secondary overlay should be displayed. From e1c264f8fd138c3f149df0ecfff55416fdd97e33 Mon Sep 17 00:00:00 2001 From: Yehor Kharchenko Date: Wed, 29 Oct 2025 15:34:45 +0100 Subject: [PATCH 10/10] Refactor last visible RHP route key calculation into a separate function for bug prevention when using rootState --- .../WideRHPContextProvider/index.tsx | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/src/components/WideRHPContextProvider/index.tsx b/src/components/WideRHPContextProvider/index.tsx index 9a203d6b584c..5cadccf9be30 100644 --- a/src/components/WideRHPContextProvider/index.tsx +++ b/src/components/WideRHPContextProvider/index.tsx @@ -56,6 +56,22 @@ function extractNavigationKeys(state: NavigationState | PartialState isFullScreenName(route.name)); + const lastRHPRouteIndex = state.routes.findLastIndex((route) => route.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR); + + // Both routes have to be present and the RHP have to be after last full screen for it to be visible. + if (lastFullScreenRouteIndex === -1 || lastRHPRouteIndex === -1 || lastFullScreenRouteIndex > lastRHPRouteIndex) { + return undefined; + } + + return state?.routes.at(lastRHPRouteIndex)?.key; +} + /** * Calculates the optimal width for the receipt pane RHP based on window width. * Ensures the RHP doesn't exceed maximum width and maintains minimum responsive width. @@ -80,27 +96,6 @@ function WideRHPContextProvider({children}: React.PropsWithChildren) { const [allWideRHPRouteKeys, setAllWideRHPRouteKeys] = useState([]); const [shouldRenderSecondaryOverlay, setShouldRenderSecondaryOverlay] = useState(false); const [expenseReportIDs, setExpenseReportIDs] = useState>(new Set()); - const [navigationUpdateTrigger, setNavigationUpdateTrigger] = useState(false); - - // Return undefined if RHP is not the last route - const lastVisibleRHPRouteKey = useRootNavigationState((state) => { - // Safe handling when navigation is not yet initialized - if (!state) { - return undefined; - } - const lastFullScreenRouteIndex = state?.routes.findLastIndex((route) => isFullScreenName(route.name)); - const lastRHPRouteIndex = state?.routes.findLastIndex((route) => route.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR); - - // Both routes have to be present and the RHP have to be after last full screen for it to be visible. - if (lastFullScreenRouteIndex === -1 || lastRHPRouteIndex === -1 || lastFullScreenRouteIndex > lastRHPRouteIndex) { - return undefined; - } - - // Trigger recalculation of wideRHPRouteKeys after navigation initialization - // This ensures proper wide RHP display on page reload or deep links when lastVisibleRHPRouteKey becomes available - setNavigationUpdateTrigger(true); - return state?.routes.at(lastRHPRouteIndex)?.key; - }); const wideRHPRouteKeys = useMemo(() => { const rootState = navigationRef.getRootState(); @@ -109,6 +104,7 @@ function WideRHPContextProvider({children}: React.PropsWithChildren) { return []; } + const lastVisibleRHPRouteKey = getLastVisibleRHPRouteKey(rootState); const lastRHPRoute = rootState.routes.find((route) => route.key === lastVisibleRHPRouteKey); if (!lastRHPRoute) { @@ -119,11 +115,7 @@ function WideRHPContextProvider({children}: React.PropsWithChildren) { const currentKeys = allWideRHPRouteKeys.filter((key) => lastRHPKeys.has(key)); return currentKeys; - // We intentionally exclude lastVisibleRHPRouteKey from dependencies to prevent immediate - // recalculation when RHP closes, allowing smooth closing animations to complete - // eslint-disable-next-line react-compiler/react-compiler - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [allWideRHPRouteKeys, navigationUpdateTrigger]); + }, [allWideRHPRouteKeys]); /** * Determines whether the secondary overlay should be displayed.