Hello, I've got Fragment A (Start Destination) and...
# navigation-architecture-component
g
Hello, I've got Fragment A (Start Destination) and then Fragment B which both use the same ViewModel, both using
saveStateHandle["id"]
to get an id from a deeplink. When coming back from Fragment B to Fragment A, The ViewModel of Fragment A also receives the same parameter
id
as the ViewModel of Fragment B receives it. Weird or what am I missing here?
d
Your viewModel is not recreated as your are navigating from one fragment to another.
g
Indeed, but each fragment has its own instance. I've looked into the implementation of the library and it turns out all destinations to a deep link receive the same data in their bundle, aka the deep link itself and the parsed parameters of the destination, which feels weird to me but knowing this I've made the right adjustments 😊
👍 1