Super weird to see navigation action be executed as part of the composition process, rather than as a SideEffect or DisposableEffect or LaunchedEffect.
Do you mean the popBackStack call? That really is awkward like that, but it just mirrors the already slightly awkward API that MessageListViewModel has. Plus, umm, it works :D
Back navigation is clearly an event/effect and not a state change, this is some legacy code that hasn't been cleaned up yet. End users rarely see this, as they usually just connect the ViewModel and its proper View with a single method call, and not use the ViewModel APIs directly.
You invoke the navigation action as you normally would with a method call (not setting 'should navigate to' in state and then handle it as part of recomposition, which is really odd), and then the AnimatingComposeStateChanger I wrote governs the actual transition using a LaunchedEffect
2
u/Zhuinden EpicPandaForce @ SO Mar 22 '21
Super weird to see navigation action be executed as part of the composition process, rather than as a SideEffect or DisposableEffect or LaunchedEffect.