When initializing the navigator using Navigator(screens = screenStack), it becomes impossible to change the list of screens using the same constructor. This issue becomes problematic for the implementation of deep links.
val screenStack by screenStackFlow.collectAsState()
Navigator(screens = screenStack) // screen list never changes even if screenStack changes
The only workaround I found was to use navigator.replaceAll to swap the entire stack at once.
// This works
val screenStack by screenStackFlow.collectAsState()
Navigator(screens = screenStack) {
CurrentScreen()
it.replaceAll(screenStack)
}
Expected Behavior
Once screenStack is a state and its content changes, the list of screens in the Navigator(screens = screenStack) composable should change accordingly, respecting the state.
Issue with Deep Link Implementation
Current Behavior
When initializing the navigator using
Navigator(screens = screenStack)
, it becomes impossible to change the list of screens using the same constructor. This issue becomes problematic for the implementation of deep links.The only workaround I found was to use navigator.replaceAll to swap the entire stack at once.
Expected Behavior
Once screenStack is a state and its content changes, the list of screens in the Navigator(screens = screenStack) composable should change accordingly, respecting the state.
Sample
The issue can be observed in this sample project
bugsample.zip