dorche
12/03/2025, 3:43 PMDavid Kurzica
12/04/2025, 7:07 PMdorche
12/04/2025, 8:49 PM- pressing the tab again should reset its' backstack and scrollBut I can't find any guidance about this anywhere - nothing on the official docs talks about this at all and nothing on the official samples either.
dorche
12/04/2025, 8:52 PMpopUpTo , saveState , launchSingleTop & restoreState that would achieve this resetting of the tab's backstack and scroll position (and properly cleans up any "savedState"s so that we don't end up with tons of them in memory).Ian Lake
12/04/2025, 11:19 PMNavHost), then each tab is associated with a top level @Serializable class or a String, depending on whether you are using type safe navigation, but the concepts in that stack overflow question are exactly the same from Fragments to Compose since it is the exact same NavController they both use. So if you want to pop everything up to the top level class, popBackStack, just like that answer says, is enoughdorche
12/05/2025, 10:29 AMsaveState , restoreState and launchSingleTop all true + popUpTo starting destination
• If the user is clicking on an already selected bottom nav tab (Tab A), just popBackStack to the top level destination, without worrying about state and there's nothing to "clean up"? So if after this the user clicks on Tab B again and then on Tab A, we won't see the "old" saved state of it again and instead it will expectedly show it's top level destination.
That final bit of the 2nd bullet point is my real worry, don't understand enough of the saving and restoring mechanism to know if there's gonna by anything else that I'd need to manually do.Ian Lake
12/05/2025, 2:25 PMpopBackStack is what clears state