Use derivedStateOf for selectedAccount too

This commit is contained in:
Benoit Marty
2026-10-07 10:40:54 +02:00
parent 3c212ae9a3
commit 30b71cf90b
@@ -72,8 +72,12 @@ class RoomSelectPresenter(
list.map { it.toMatrixUser() }
}
}.collectAsState(initial = emptyList())
// Fallback to a MatrixUser with only the userId until the sessions are loaded
val selectedAccount = accounts.find { it.userId == selectedSessionId } ?: MatrixUser(selectedSessionId)
val selectedAccount by remember {
derivedStateOf {
// Fallback to a MatrixUser with only the userId until the sessions are loaded
accounts.find { it.userId == selectedSessionId } ?: MatrixUser(selectedSessionId)
}
}
val otherAccounts by remember {
derivedStateOf {
accounts.filter { it.userId != selectedSessionId }.toImmutableList()