Makes sure the accountViewModel is deleted when the user switches the screen, logs off or kills the activity.
This commit is contained in:
@@ -102,6 +102,12 @@ fun AccountScreen(
|
|||||||
sharedPreferencesViewModel,
|
sharedPreferencesViewModel,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DisposableEffect(key1 = accountState) {
|
||||||
|
onDispose {
|
||||||
|
state.currentViewModelStore.viewModelStore.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
is AccountState.LoggedInViewOnly -> {
|
is AccountState.LoggedInViewOnly -> {
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
@@ -113,6 +119,12 @@ fun AccountScreen(
|
|||||||
sharedPreferencesViewModel,
|
sharedPreferencesViewModel,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DisposableEffect(key1 = accountState) {
|
||||||
|
onDispose {
|
||||||
|
state.currentViewModelStore.viewModelStore.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user