Skip to content

Commit

Permalink
Change to create a viewModelContext using the received viewModelStore…
Browse files Browse the repository at this point in the history
…Owner and savedStateRegistry.

- Even if create and pass a custom lifecycle scope in Fragment, `mavericksViewModel` function uses the fragment's lifecycleScope.
  • Loading branch information
JSpiner authored and smith.jspiner committed Mar 18, 2024
1 parent 7a3bedb commit 63bfac0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ inline fun <reified VM : MavericksViewModel<S>, reified S : MavericksState> mave

if (parentFragment != null) {
val args = argsFactory?.invoke() ?: parentFragment.arguments?.get(Mavericks.KEY_ARG)
FragmentViewModelContext(activity, args, parentFragment)
FragmentViewModelContext(activity, args, parentFragment, viewModelStoreOwner, savedStateRegistry)
} else {
val args = argsFactory?.invoke() ?: activity.intent.extras?.get(Mavericks.KEY_ARG)
ActivityViewModelContext(activity, args, viewModelStoreOwner, savedStateRegistry)
Expand Down

0 comments on commit 63bfac0

Please sign in to comment.