Closed thadcodes closed 3 months ago
@thadcodes out of curiosity, might this also be related to https://github.com/InsertKoinIO/koin/issues/1831 which sounds similar 🤔
@thadcodes out of curiosity, might this also be related to #1831 which sounds similar 🤔
Yes that could be the same, but part of what causes this is having 2 view model classes used in the same scope and same view lifecycle. I suspect a way to test is to give your view model a qualifier even if you don't need it and see if the issue goes away
Yes, known issue in 3.5.3 due to VM key generation. It's fixed in 3.5.4.
Yes, known issue in 3.5.3 due to VM key generation. It's fixed in 3.5.4.
Can you point to the fix? I'm unclear how this wouldn't still be happening on the main branch
Yes, known issue in 3.5.3 due to VM key generation. It's fixed in 3.5.4.
Thanks, I see that scope was removed from the key in 3.5.4, so I'll close
Describe the bug If using compose you fetch two different view model classes using
org.koin.androidx.compose.koinViewModel
with a non-root scope, every time a recompose happens a new instance of each view model will be returned.Note: I know the issue is with the way the key is being generated and will submit a PR shortly as well
To Reproduce Steps to reproduce the behavior:
Expected behavior Every time `view model: {Instance}" is printed it should be the same time
Koin module and version:
koin-androidx-compose:3.5.3
koin-android:3.5.3
Snippet or Sample project to help reproduce Sample project to reproduce the issue. It's a reused project from reporting another issue so disregard the name koinQualifierIssue.zip