nowinandroid
nowinandroid copied to clipboard
[Bug] Navigation Failure : launchSingleTop and saveState True Conditions Cause No Action
Is there an existing issue for this?
- [X] I have searched the existing issues
Is there a StackOverflow question about this issue?
- [X] I have searched StackOverflow
What happened?
https://github.com/android/nowinandroid/assets/38935359/ec56c4fb-78f9-41a7-9d7d-797ddfc6a8f9
After investigating issue #997 and reviewing the code, I believed the inability to navigate to the 'ForYou' tab, as demonstrated in the video, was due to both launchSingleTop
and saveState
being set to true
.
Due to saveState
being set to true
, when the 'NavBackStack' already contains a 'ForYou destination', it attempts to reuse this destination. However, if launchSingleTop
is also set to true
, it tries to create a new 'ForYou Destination' even if it already exists unless the Destination being added is not at the top of the 'NavBackStack'. This conflict seems to result in no action being taken.
Given this, I considered that using popBackStack
to clear the stack in 'NavBackStack' might work, and indeed, it functioned as anticipated.
https://github.com/android/nowinandroid/assets/38935359/c32d7ea3-8856-4008-b6fe-b6171ade50d8
My question is, when attempting to reuse an existing destination in the 'NavBackStack' with both launchSingleTop
and saveState
set to true
, is it accurate that these settings conflict and lead to no action?
@manuelvicnt, @SimonMarquis, @dturner, @tunjid PTAL..
Relevant logcat output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct