Skip to content

Commit 8516d9c

Browse files
committed
revert some unnecessary changes
1 parent 9318619 commit 8516d9c

2 files changed

Lines changed: 28 additions & 26 deletions

File tree

Mobile-Expensify

src/libs/Navigation/helpers/getAdaptedStateFromPath.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -190,40 +190,42 @@ function getMatchingFullScreenRoute(route: NavigationPartialRoute) {
190190
};
191191
}
192192

193-
const dynamicSuffixMatch = findMatchingDynamicSuffix(route?.path);
194193
// Handle dynamic routes: find the appropriate full screen route
195-
if (route.path && dynamicSuffixMatch) {
196-
// Strip the suffix from the URL. For parametric routes we pass both the actual URL
197-
// suffix and the registered pattern so query params can be resolved correctly.
198-
const pathWithoutDynamicSuffix = getPathWithoutDynamicSuffix(route.path, dynamicSuffixMatch.actualSuffix, dynamicSuffixMatch.pattern);
194+
if (route.path) {
195+
const suffixMatch = findMatchingDynamicSuffix(route.path);
196+
if (suffixMatch) {
197+
// Strip the suffix from the URL. For parametric routes we pass both the actual URL
198+
// suffix and the registered pattern so query params can be resolved correctly.
199+
const pathWithoutDynamicSuffix = getPathWithoutDynamicSuffix(route.path, suffixMatch.actualSuffix, suffixMatch.pattern);
200+
201+
if (!pathWithoutDynamicSuffix) {
202+
return undefined;
203+
}
199204

200-
if (!pathWithoutDynamicSuffix) {
201-
return undefined;
202-
}
205+
// Parse the base path (without dynamic suffix) into a navigation state
206+
// to determine which full-screen route should be visible underneath the overlay.
207+
const stateUnderDynamicRoute = getStateFromPath(pathWithoutDynamicSuffix);
208+
const lastRoute = stateUnderDynamicRoute?.routes.at(-1);
203209

204-
// Parse the base path (without dynamic suffix) into a navigation state
205-
// to determine which full-screen route should be visible underneath the overlay.
206-
const stateUnderDynamicRoute = getStateFromPath(pathWithoutDynamicSuffix);
207-
const lastRoute = stateUnderDynamicRoute?.routes.at(-1);
210+
if (!stateUnderDynamicRoute || !lastRoute || lastRoute.name === SCREENS.NOT_FOUND) {
211+
return undefined;
212+
}
208213

209-
if (!stateUnderDynamicRoute || !lastRoute || lastRoute.name === SCREENS.NOT_FOUND) {
210-
return undefined;
211-
}
214+
const isLastRouteFullScreen = isFullScreenName(lastRoute.name);
212215

213-
const isLastRouteFullScreen = isFullScreenName(lastRoute.name);
216+
if (isLastRouteFullScreen) {
217+
return lastRoute;
218+
}
214219

215-
if (isLastRouteFullScreen) {
216-
return lastRoute;
217-
}
220+
const focusedRouteUnderDynamicRoute = findFocusedRouteWithOnyxTabGuard(stateUnderDynamicRoute);
218221

219-
const focusedRouteUnderDynamicRoute = findFocusedRouteWithOnyxTabGuard(stateUnderDynamicRoute);
222+
if (!focusedRouteUnderDynamicRoute) {
223+
return undefined;
224+
}
220225

221-
if (!focusedRouteUnderDynamicRoute) {
222-
return undefined;
226+
// Recursively find the matching full screen route for the focused dynamic route
227+
return getMatchingFullScreenRoute(focusedRouteUnderDynamicRoute);
223228
}
224-
225-
// Recursively find the matching full screen route for the focused dynamic route
226-
return getMatchingFullScreenRoute(focusedRouteUnderDynamicRoute);
227229
}
228230

229231
return undefined;

0 commit comments

Comments
 (0)