I use Android ViewModel in common code for Compose...
# compose-desktop
d
I use Android ViewModel in common code for Compose for Desktop (JVM) like described here https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-viewmodel.html. This works all nice in production, however in tests I experience flakiness on the CI (and here only for the Desktop platform, never for the Android platform) for things that are signaled to the UI via coroutines in
viewModelScope
. I know the implementations differ slightly between, but is there anything that I can do to straighten the issues out?
a
Can you post a short reproducer?
d
That's hard, it's all closed source. I compiled together a Gist to show off what I'm doing. I guess the culprit might be my "stolen"
flowWithLifecycle
implementation: https://gist.github.com/realdadfish/51efef1bd38b058544925c43c9022d55
Don't know if an official alternative to this exists nowadays