hey guys, is there anyone facing this kinda issue ...
# compose-android
h
hey guys, is there anyone facing this kinda issue using KMP navigation with multi stack bottom bar and ViewModel, i’ve created a min reproducible repo https://github.com/FunkyMuse/kmp-multi-stack-navigation-issue a view model is being re-created all the time except the starting point ViewModel which stays the same all the time, is it an issue in the code or an actual bug I’ve used this code on Android before and just copy pasted it here for KMP, although i’m not sure whether this has to do something with the new type-safety where i adapted the code in the wrong way
a
Could be related to popping the graph stack to the first destination every time you switch tabs. Override the on clear method on each view model see if its that.
h
I did override, but that method doesn’t get called even if i print the owner a weird thing happens
image.png
a
instead of route = ExploreGraph.ExploreScreen use route = ExploreGraph, since you are changing between graphs.
h
this does work indeed, thank you
how in this scenario you would know which one is selected?
Copy code
currentEntry?.destination?.hierarchy?.any {
    it.hasRoute(bottomEntryRoute::class)
} == true
a
Mby look at the top of the backstack