Tlaster / PreCompose

Compose Multiplatform Navigation && State Management

Home Page:https://tlaster.github.io/PreCompose/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

invoking goBack will break navigation if nav transitions are used

sphrak opened this issue · comments

Hello,
This seems to have been introduced between somewhere 1.5.8..1.5.9 - what happens when the bug occurs is that canGoBack always returns false here

Made a repro here: https://github.com/sphrak/precompose-gobackbug

Steps:

  1. click some destinations
  2. click "back button"
  3. click some destinations again
  4. ???
  5. can no longer navigate

AFAIK the bug only happens if you have navTransitions specified ie https://github.com/sphrak/precompose-gobackbug/blob/main/src/main/kotlin/Main.kt#L96

I will investigate more tomorrow.

Nice catch! I'm being busy recent week so might not have time to figure it out recentlly.

@Tlaster no worries, I have done some more investigation and while I still don't understand completely why it happens it seems to have to do with specifying ExitTransition.None/EnterTransition.None.. If I use fadeIn, fadeOut or simply dont specify any (effectively using the default NavTransition) instead then the bug goes away.

My guess is that navigator.stackManager.canNavigate = !transition.isRunning will always evaluate to false when *Transition.None is used..

I think I've figure it out, it because here is not being trigger when transition.isRunning is false quickly, change it to SideEffect can resolve the issue.