koin icon indicating copy to clipboard operation
koin copied to clipboard

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.

Open annotation-engine opened this issue 2 months ago • 5 comments

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.

annotation-engine avatar Oct 18 '25 17:10 annotation-engine

Is Navigation3 still not supported at present?

annotation-engine avatar Oct 18 '25 17:10 annotation-engine

?

annotation-engine avatar Oct 20 '25 13:10 annotation-engine

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)

santimattius avatar Oct 31 '25 19:10 santimattius

And CMP check this version https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.10.0-alpha03

santimattius avatar Oct 31 '25 19:10 santimattius

I have solved this problem. Thank you.

annotation-engine avatar Nov 14 '25 14:11 annotation-engine