I have a navigation graph with two Screens:
- SCREEN_A, and;
- SCREEN_B;
SCREEN_A can navigate to SCREEN_B.
SCREEN_B returns a value in the following way
navController
.previousBackStackEntry
?.savedStateHandle
?.set(resultKey, "RESULT_HERE")
and SCREEN_A listens to that result like this
val navResult = navController.currentBackStackEntry
?.savedStateHandle
?.getLiveData<Parcelable>(RESULT_KEY)
?.observeAsState()
The problem I'm currently facing is that if SCREEN_B returns the result in a short period of time (like, in less than 0.5 seconds), SCREEN_A does not receive that result and is not recomposed.
If I force a delay of some seconds in SCREEN_B before returning to SCREEN_A, everything works as expected. SCREEN_A receives the result and is recomposed.
Is that some kind of bug or am I doing something wrong?