Skip to content

Commit

Permalink
Makes sure the accountViewModel is deleted when the user switches the…
Browse files Browse the repository at this point in the history
… screen, logs off or kills the activity.
  • Loading branch information
vitorpamplona committed Aug 26, 2024
1 parent 7b8c7a1 commit 4b24915
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ fun AccountScreen(
sharedPreferencesViewModel,
)
}

DisposableEffect(key1 = accountState) {
onDispose {
state.currentViewModelStore.viewModelStore.clear()
}
}
}
is AccountState.LoggedInViewOnly -> {
CompositionLocalProvider(
Expand All @@ -113,6 +119,12 @@ fun AccountScreen(
sharedPreferencesViewModel,
)
}

DisposableEffect(key1 = accountState) {
onDispose {
state.currentViewModelStore.viewModelStore.clear()
}
}
}
}
}
Expand Down

0 comments on commit 4b24915

Please sign in to comment.