Skip to content

Commit cfdef80

Browse files
committed
fix: route full AppRoutes from chat to the outer nav host
Opening Phantom via Add Money inside a chat crashed with IllegalStateException: Unknown screen Swap(...). FlowConversationScreen handled Event.OpenScreen (non-sheet branch) via LocalCodeNavigator, which inside a FlowHost is the inner navigator whose backstack only registers ChatStep keys. Pushing a full AppRoute.Token.Swap onto it hit Navigation 3's fallback. Route full AppRoutes to LocalOuterCodeNavigator instead, whose nav host (appEntryProvider) registers Token.Swap/Info/Discovery. This also fixes the same latent crash for Token.Discovery (ChatViewModel:709) and Token.Info (MessengerScreen:124). Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent a09f8c1 commit cfdef80

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • apps/flipcash/features/messenger/src/main/kotlin/com/flipcash/app/messenger

apps/flipcash/features/messenger/src/main/kotlin/com/flipcash/app/messenger/ChatFlowScreen.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ private fun chatEntryProvider(
6262
private fun FlowConversationScreen(identifier: ChatIdentifier) {
6363
val viewModel = flowSharedViewModel<ChatViewModel>()
6464
val navigator = LocalCodeNavigator.current
65+
// The outer app/sheet nav host. Its entryProvider (appEntryProvider) registers
66+
// full AppRoutes like Token.Swap/Info/Discovery; the inner [navigator] only knows
67+
// this flow's ChatStep keys, so full routes must be pushed onto the outer navigator.
68+
val outerNavigator = LocalOuterCodeNavigator.current
6569
// The sheet-owning (root) navigator — the one whose back stack holds this chat's
6670
// Main.Sheet and whose pendingSheetDismiss the dismiss animation observes.
6771
val sheetNavigator = LocalSheetNavigator.current
@@ -92,7 +96,9 @@ private fun FlowConversationScreen(identifier: ChatIdentifier) {
9296
// sheet closed (via pendingSheetDismiss) before opening the new one.
9397
sheetNavigator?.openAsSheet(route)
9498
} else {
95-
navigator.navigate(route)
99+
// Push onto the outer nav host (which registers full AppRoutes) rather
100+
// than the inner flow navigator, whose backstack only handles ChatSteps.
101+
outerNavigator.navigate(route)
96102
}
97103
}
98104
}

0 commit comments

Comments
 (0)