https://kotlinlang.org logo
#koin-dev
Title
# koin-dev
l

Lukas Anda

10/13/2023, 7:35 AM
Hey guys, anyone has experienced a weird issue (I’m hoping my setup is wrong) that when I have a backstack of screens using compose navigation, that the viewmodel that is in the backstack still observes the flows? I know that I can solve it using DisposableEffect but that is not exactly what I want to have there. In my app, I am using
KoinContext()
as a wrapper function for my main composable and then in the
Application
class (android) I’m calling the multiplatform
startKoin
method. Any ideas as to what might be happening?
a

arnaud.giuliani

10/13/2023, 2:48 PM
Did you tried with the
KoinAndroidContext
it binds on current Android context more than the default Koin context
l

Lukas Anda

10/13/2023, 2:51 PM
Yes, didn’t work for me. But I guess that was the expected behaviour since when I disabled it (using some handy function that makes it recreate the viewmodel on dispose) it broke the functionality of the app, so I guess this is solved kinda
a

arnaud.giuliani

10/13/2023, 2:55 PM
apparently