Skip to content

Commit

Permalink
Create 2 new modules to manage Jetpack Compose specific behaviours
Browse files Browse the repository at this point in the history
  • Loading branch information
romainbsl committed Apr 3, 2023
1 parent c52c8b0 commit 298a9dd
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public inline fun <reified VM : ViewModel> NavBackStackEntry.rememberNavGraphVie
): ViewModelLazy<VM> = with(
localDI()
) {
remember {
remember(this@rememberNavGraphViewModel) {
ViewModelLazy(
viewModelClass = VM::class,
storeProducer = { navHostController.getBackStackEntry(getParentId()).viewModelStore },
Expand All @@ -55,7 +55,7 @@ public inline fun <reified VM : ViewModel> 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)
Expand Down Expand Up @@ -90,7 +90,7 @@ public inline fun <reified A: Any, reified VM : ViewModel> NavBackStackEntry.rem
): ViewModelLazy<VM> = with(
localDI()
) {
remember {
remember(this@rememberNavGraphViewModel) {
ViewModelLazy(
viewModelClass = VM::class,
storeProducer = { navHostController.getBackStackEntry(getParentId()).viewModelStore },
Expand Down Expand Up @@ -126,7 +126,7 @@ public inline fun <reified A: Any, reified VM : ViewModel> NavBackStackEntry.nav
tag: String? = null,
arg: A,
): VM = with(localDI()) {
remember {
remember(this@navGraphViewModel) {
val provider = ViewModelProvider(
navHostController.getBackStackEntry(getParentId()).viewModelStore,
KodeinViewModelScopedFactory(
Expand Down

0 comments on commit 298a9dd

Please sign in to comment.