Router.push is ignored when in the process of transitioning to another component.
See original GitHub issueI’ve found a bug where a router push event is ignored when performed during an ongoing navigation.
I haven’t migrated to the latest Kotlin yet, so I’m still on Decompose 0.1.7
, and Kotlin 1.4.21-2
Here is the situation:
I have a RootComponent
, which has 3 child components, A
, B
, and C
.
We start the app by displaying A
where an auth occurs
router.navigate { listOf(Screen.A) }
After the user logs in, we navigate to Screen B
, and remove A
from the backstack:
router.navigate { listOf(Screen.B) }
Inside of Component B
, I was trying to debug something and so I called
init {
lifecycle.doOnResume {
resumePauseLaunch { loadData() }
output(Output.ActionThatNavigatesToC)
}
}
Which ultimately triggers this in the root component:
router.push(Screen.C)
Even though C
is the last screen pushed to, the View isn’t updated and it just stays on Screen B
. Calling output(Output.ActionThatNavigatesToC)
after the screen transition to B has completed, works as intended.
Message me on Slack, and I can step you through the code if you’d like more details.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Thanks! This looks like the same issue. Component C is being pushed recursively. I will fix.
I’ve accurately reproduced it here:
MainActivity:
Here is the Output:
Notice how we end by showing B, instead of C which is the intended behavior.