I found cyclic navigation when the user tries to n...
# confetti
b
I found cyclic navigation when the user tries to navigate back off of the stack. I assume this is not the intended behavior.
Screen_recording_20230424_203317.mp4
m
Going from
SessionDetails -> Speaker -> SessionDetails -> Speaker
right?
b
Yeah, then pressing back button.
m
What would be the intended behaviour? It's a bit weird here because it loops on Chet's talk but you can theorically do something else: •
Some UI Talk
Chet Haase
Some Other Comedy Talk
Romain Guy
Some Romain Guy Talk
• etc...
Looking in the backstack for similar ids maybe?
But then it becomes really hard to predict the logic
b
Yeah, it’s a bit tricky. Maybe check the back stack, if the destination composable is the last added to back stack, we just navigate back instead of creating a new composable. Wdyt?
But then we would need to know the ids used in the route so we can compare them to know that the exact same composable is the previous one.
m
Works for me. I'm not sure there's a generally "good" answer to that probelm
m
There is an option on navigation that navigates to the route back in the back stack if it already exists.
m
But then it's potentially an issue if you have a permutation with more than 2 destinations
m
I'm out of my computer now, can look for it later. But should be in the options lambda.
m
A -> B -> C. Navigating to A pops B forever
At least this is how I would imagine things to work?
m
@mbonnin I think it "brings" the navigation entry to the top, actually. Not super sure.
m
Mmm I see
b
do you mean the
launchSingleTop = true
?
m
Anyway, we may be overthinking a little. The current behaviour (or skip a few) won't cause much issues IMO.
What I would personally do is to not navigate the whole screen.
m
Agree, at the end of the day, it's "okay"
b
I’ve tried a couple of approaches but didn’t get it right so far. =(
m
But only the content of the tab, so if the user presses the tab it cuts the back stack.
That is the main advantage of having multi back stack support, which Navigastion has.
m
Ah yea, allowing to go back to top level without having to press back 50 times sounds interesting 🙂
I've seen apps where clicking to the currently focused tab would also reset it to the top level
m
Yes, exactly.