diff --git a/framework/compose/kodein-di-framework-compose-android-navigation/src/androidMain/kotlin/org/kodein/di/compose/android/navigation/navGraphViewModel.kt b/framework/compose/kodein-di-framework-compose-android-navigation/src/androidMain/kotlin/org/kodein/di/compose/android/navigation/navGraphViewModel.kt index d820538c..6589336e 100644 --- a/framework/compose/kodein-di-framework-compose-android-navigation/src/androidMain/kotlin/org/kodein/di/compose/android/navigation/navGraphViewModel.kt +++ b/framework/compose/kodein-di-framework-compose-android-navigation/src/androidMain/kotlin/org/kodein/di/compose/android/navigation/navGraphViewModel.kt @@ -30,7 +30,7 @@ public inline fun NavBackStackEntry.rememberNavGraphVie ): ViewModelLazy = with( localDI() ) { - remember { + remember(this@rememberNavGraphViewModel) { ViewModelLazy( viewModelClass = VM::class, storeProducer = { navHostController.getBackStackEntry(getParentId()).viewModelStore }, @@ -55,7 +55,7 @@ public inline fun NavBackStackEntry.navGraphViewModel( navHostController: NavHostController, tag: String? = null ): VM = with(localDI()) { - remember { + remember(this@navGraphViewModel) { val provider = ViewModelProvider( navHostController.getBackStackEntry(getParentId()).viewModelStore, KodeinViewModelScopedSingleton(di = di, tag = tag) @@ -90,7 +90,7 @@ public inline fun NavBackStackEntry.rem ): ViewModelLazy = with( localDI() ) { - remember { + remember(this@rememberNavGraphViewModel) { ViewModelLazy( viewModelClass = VM::class, storeProducer = { navHostController.getBackStackEntry(getParentId()).viewModelStore }, @@ -126,7 +126,7 @@ public inline fun NavBackStackEntry.nav tag: String? = null, arg: A, ): VM = with(localDI()) { - remember { + remember(this@navGraphViewModel) { val provider = ViewModelProvider( navHostController.getBackStackEntry(getParentId()).viewModelStore, KodeinViewModelScopedFactory(