I was using a single Activity design. Why, when using Jetbrains' Navigation3, does the ViewModel not clean up when the page is closed? And when I re-enter the page, the previous data is still retained.
I was using a single Activity design. Why, when using Jetbrains' Navigation3, does the ViewModel not clean up when the page is closed? And when I re-enter the page, the previous data is still retained.
Is Navigation3 still not supported at present?
?
Hi @annotation-engine , could you check out this example: https://github.com/android/nav3-recipes/tree/main/app/src/main/java/com/example/nav3recipes/passingarguments/viewmodels/koin. Beyond Koin, the ViewModel handling changes slightly; now you need to add the following Entry Decorators: rememberSaveableStateHolderNavEntryDecorator(), rememberViewModelStoreNavEntryDecorator() (https://developer.android.com/guide/navigation/navigation-3/save-state)
And CMP check this version https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.10.0-alpha03
I have solved this problem. Thank you.