I have a question about a behavior that I didn't e...
# compose
c
I have a question about a behavior that I didn't expect. 1. I have a
Copy code
@Composable
fun ForgotPasswordScreen(successEvent: () -> Unit, vm: ForgotPasswordScreenViewModel){
...
  ~buttonOnClick {
    vm.makeNetworkCall(successEvent)
  }
...
}
2. successEvent: () -> Unit, is a navigational event that takes me back to SignInScreen 3. ForgotPasswordScreenViewModel has
fun makeNetworkCall(onNetworkCallCompletedSuccessfully: () -> Unit)
and on completion of the network call,
if (call.isSuccessful) successEvent()
When I throttle the network call (for testing) it takes like 10 seconds, and I background the app, wait 20+ seconds... and I come back in the app, I can see that the app navigated successfully and the SignInScreen is showing. I guess I was wrong in thinking that the successEvent() wouldn't have any action since the app was backgrounded?
a
You can update your states in background. The changes will be applied when the app comes back to foreground.
c
Yeah, I understand updating state in the background... I guess I just didn't expect the event to be triggered... but I guess the event is triggered, which navcontroller or w/e updates the state of the current nav graph, and when I come back I see that state.