I’m running into something interesting with Naviga...
# compose
j
I’m running into something interesting with Navigation compose. Wondering if anyone here knows if this is a bug or WAI. This has to do with having a deep link defined on a composable destination that is within a custom Nav Graph 🧵
The NavGraph has a start destination and in this scenario the deep link destination is another route within the graph. We use the deep link intent and arguments from SavedStateHandle to get data from the deep link URL. I’m seeing that the deep link intent url and nav arguments are also being set in the SavedStateHandle for the start destination when we navigate back to it.
This is causing some unexpected behavior because that start destination is sort of our home screen and so some handling for that deep link data is happening every time we go back to that screen.
My expectation was that the deep link data would only be attached to the bundle for the destination screen and not also the start destination for the nav graph
i
Yes, every screen in the synthetic back stack is passed the arguments and full deep link of the final destination, that is intentional. For example, if you had a RESTful kinds of routes of
group/{groupId}
and
group/{groupId}/member/{userId}
, then the
groupId
would actually be filled in for the other instance rather than be missing
j
yeah, that is our exact situation with the restful routes. Given that context I can see why it works this way. thanks!