Skip to content

Commit d6a3bd0

Browse files
committed
add new lines above comments in GetStateForActionHandlers
1 parent ef4f1c4 commit d6a3bd0

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/libs/Navigation/AppNavigator/createRootStackNavigator/GetStateForActionHandlers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,16 @@ const STALE_DEEP_LINK_PARAM_KEYS = new Set(['state', 'screen', 'params', 'path',
5959
/** Removes the RN deep-link hint chain from `route.params` when triggered by `params.screen`. */
6060
function withSanitizedDeepLinkParams<R extends {params?: unknown}>(route: R, focusParams: Record<string, unknown> | undefined): R {
6161
const rParamsRecord = route.params as Record<string, unknown> | undefined;
62+
6263
// RN stores nested deep-link instructions under params.screen/params.params.
6364
const looksLikeDeepLinkInitialState = !!rParamsRecord && typeof rParamsRecord.screen === 'string';
6465
const shouldSanitizeExistingParams = looksLikeDeepLinkInitialState && !!rParamsRecord;
66+
6567
// Remove only RN's hint keys; keep any real params that were stored next to them.
6668
const sanitizedExistingParams = shouldSanitizeExistingParams ? Object.fromEntries(Object.entries(rParamsRecord).filter(([key]) => !STALE_DEEP_LINK_PARAM_KEYS.has(key))) : rParamsRecord;
6769
const hasSanitizedExistingParams = !!sanitizedExistingParams && Object.keys(sanitizedExistingParams).length > 0;
6870
const fallbackParams = hasSanitizedExistingParams ? sanitizedExistingParams : undefined;
71+
6972
// The new focused tab params win; otherwise keep the cleaned existing params.
7073
const nextParams = focusParams ?? fallbackParams;
7174

0 commit comments

Comments
 (0)