```val multiSelectionEnabled = rememberSaveable{mu...
# compose
m
Copy code
val multiSelectionEnabled = rememberSaveable{mutableStateOf(selection.isNotEmpty())}.value
Will changing selection, trigger a recomposition? Can this be used instead of using delegates?
s
No. You need to set
selection
as a key:
Copy code
var multiSelectionEnabled by rememberSaveable(selection) { mutableStateOf(selection.isNotEmpty()) }
But, unless you need to change
multiSelectionEnabled
manually, neither
rememberSaveable
nor
mutableStateOf
is needed here (that
.value
is what makes me think you are missing something)
1
z
What is
selection
? If it's a snapshot state then this seems like a good use for
derivedStateOf
1
m
@Zach Klippenstein (he/him) [MOD] it's not a snapshot state. İt's just an array of selections passed to composables that need it