In #89006 we patched an iOS swipe-back regression where the underlying TAB_NAVIGATOR's nested state was lost — once more than two TAB_NAVIGATORs were stacked (workspace → settings → reports via RHP "learn more"), slicing rendered routes dropped the oldest tab's state and iOS swipe-back rehydrated it from scratch with index=0 (Home).
The current fix is a magic-number guard in src/libs/Navigation/AppNavigator/createRootStackNavigator/useCustomRootStackNavigatorState/index.ios.ts:
const SKIP_SLICE_TAB_THRESHOLD = 4;
if (tabCount <= SKIP_SLICE_TAB_THRESHOLD) {
stateToRender = state; // skip slicing entirely
} else {
// ...slice as before
}
This unblocks the deploy but is a temporary hotfix — any future flow that stacks more TAB_NAVIGATORs will hit the same bug class.
Proposed solution
Drop the threshold and rebuild the dropped TAB_NAVIGATOR's state from preservedNavigatorStates (already used by cleanPreservedNavigatorStates in NavigationRoot.tsx) when react-navigation rehydrates a sliced-out route on swipe-back. Slicing can stay aggressive for performance once state survives the round-trip.
References
In #89006 we patched an iOS swipe-back regression where the underlying
TAB_NAVIGATOR's nested state was lost — once more than two TAB_NAVIGATORs were stacked (workspace → settings → reports via RHP "learn more"), slicing rendered routes dropped the oldest tab's state and iOS swipe-back rehydrated it from scratch withindex=0(Home).The current fix is a magic-number guard in
src/libs/Navigation/AppNavigator/createRootStackNavigator/useCustomRootStackNavigatorState/index.ios.ts:This unblocks the deploy but is a temporary hotfix — any future flow that stacks more TAB_NAVIGATORs will hit the same bug class.
Proposed solution
Drop the threshold and rebuild the dropped TAB_NAVIGATOR's state from
preservedNavigatorStates(already used bycleanPreservedNavigatorStatesinNavigationRoot.tsx) when react-navigation rehydrates a sliced-out route on swipe-back. Slicing can stay aggressive for performance once state survives the round-trip.References
src/libs/Navigation/AppNavigator/createRootStackNavigator/useCustomRootStackNavigatorState/index.ios.ts