WAI
Status Update
Comments
ch...@google.com <ch...@google.com> #2
We are also seeing this issue, affects users in production. Is there a workaround for this?
Other than downgrading to jetpack navigation 2.7 where we don't see this issue (as suggested by someone here:
Description
Jetpack Compose version: Bom 2024.11.00
Jetpack Compose component(s) used: runtime and ui
Android Studio Build: Any
Kotlin version: 1.9.0
If you update some state via a
LaunchedEffect
and that state is a condition for some other part of the code, it is possible to reach code that should be inaccessible.This is a simplier version of this issue with
PredictiveBackHandler
which updates it's enabled state as part of aLaunchedEffect
.This is the code (project also attached):
Instead of attempting to be fast enough to trigger it manually, you can trigger the error by using the debugger.
Steps to Reproduce or Code Sample to Reproduce:
trigger callback
button to ensure the callback fires (should see a toast)decrement state
button once and then click thetrigger callback
buttonIf a
LaunchedEffect
is not be the right approach for this, is there some other component that fits better?