Recreates the viewModel when the Account object changes.

This commit is contained in:
Vitor Pamplona 2023-10-23 14:32:22 -04:00
parent d3d2845f10
commit f072b98fd7

View File

@ -41,7 +41,7 @@ fun AccountScreen(
}
is AccountState.LoggedIn -> {
val accountViewModel: AccountViewModel = viewModel(
key = state.account.userProfile().pubkeyHex,
key = state.account.hashCode().toString(),
factory = AccountViewModel.Factory(state.account, sharedPreferencesViewModel.sharedPrefs)
)
@ -49,7 +49,7 @@ fun AccountScreen(
}
is AccountState.LoggedInViewOnly -> {
val accountViewModel: AccountViewModel = viewModel(
key = state.account.userProfile().pubkeyHex,
key = state.account.hashCode().toString(),
factory = AccountViewModel.Factory(state.account, sharedPreferencesViewModel.sharedPrefs)
)