The first does a single atomic event (and popUpTo is a no-op if currentPage isn't on the back stack, which probably doesn't make a difference in your case). The second one does a
navigateUp()
operation first (which is different from
popBackStack()
in cases where you have deep linked into that destination or any other case where you don't have anything before the current destination on the back stack) then does a separate
navigate()
operation after the
navigateUp()
has completed
Ian Lake
12/04/2021, 2:09 AM
In the Compose world, the snapshot system tends to paper over the non-atomic nature of the second one (as you'll only get the final state in the next recomposition)
b
brabo-hi
12/06/2021, 5:53 PM
thanks, what is the best practice if i want to close current page and navigate to next page?
I am having issue when using (https://github.com/google/accompanist/tree/main/navigation-material) it doesn’t always pop the current page. Which means from next page, when i backclick it still has current page on the stack