Makes sure the accountViewModel is deleted when the user switches the screen, logs off or kills the activity.

This commit is contained in:
Vitor Pamplona 2024-08-26 18:22:34 -04:00
parent 7b8c7a1a78
commit 4b249156f9

View File

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