sellmair / kompass

Kotlin Multiplatform Router for Android and iOS
MIT License
345 stars 12 forks source link

Sample: LoginProcessingFragment can get stuck in loading state forever #73

Closed Zhuinden closed 5 years ago

Zhuinden commented 5 years ago

https://github.com/sellmair/kompass/blob/ceed98827b5aa5687df78b83d9de8060ffc7e0dc/android-example--fragment/src/main/java/io/sellmair/kompass/android/example/viewmodel/LoginProcessingViewModel.kt#L37-L39

Because of viewModel.stop() in onPause, if app is put to background and brought to foreground while LoginProcessingFragment is on front, then the app gets stuck here forever.

You might want to consider some form of observable that the is bound to onStart/onStop rather than onPause (and no counterpart).

After rotation, it still gets stuck on the screen:

Screenshot 2019-05-06 at 13 39 37
sellmair commented 5 years ago

Thanks a lot for reporting 👍 Will fix this on Tuesday!

isaac-udy commented 5 years ago

I've got a fix for this - will open a PR when I can.

viewModel.stop() isn't actually necessary, as the onCleared will handle the case where the handler needs clearing.