Closed jollygreenegiant closed 4 months ago
Relevant discussion over in the Supabase repo (which I thought might be the cause initially): https://github.com/supabase-community/supabase-kt/discussions/549#discussion-6489297
Hmm, based on the stacktrace, it seems compose thinks it's time to clear your viewmodels. I am not sure why that would be the case though.
KMM-ViewModel is really basic on Android. It just exposes the required classes to common Kotlin code. I would be very surprised if this is somehow caused by the library.
I would expect this to be either an edge case in your compose (navigation) code, or a bug in compose itself.
That's what I figured - I'm wondering if it could also be an issue with Koin and how the viewmodels are scoped. I'll investigate further, thank you.
I'm getting a lot of errors in production relating to ktor calls being cancelled in the viewmodel when the
viewModelScope
is cleared.I have the following stack trace:
These lines in particular make it look like the ViewModel is being cleared, and the coroutine that launches the database call is being cancelled and the data is lost:
Users are seeing this on app startup on the home screen, and seemingly randomly. Some have reported that killing and restarting the app fixes it temporarily. Some have reinstalled and said that works for a little while, but the issue seems to be happening intermittently and I'm not able to reproduce it consistently on my end.
Any idea what might be causing this?