I have a `SnapshotStateMap` state variable and a r...
# compose
j
I have a
SnapshotStateMap
state variable and a regular
Map
that is generated from the state map, then provided to a Composable as follows:
Copy code
val stateMap: SnapShotStateMap<...> = remember { mutableStateMapOf() }
val anotherMap: Map<...> = stateMap.map { ... }

...

DisplayMapComposable(
    map = anotherMap, 
    changeStateMap = { // Change stateMap in some way }
)
When
changeMap
is called inside the
DisplayMapComposable
and modifies
stateMap
, will it trigger a recomposition of the
DisplayMapComposable
itself?
z
Wherever you call
.map
on the state map that is a read, so that is what will get recomposed.
j
So
anotherMap
will get recomposed, but that won't trigger a recomposition on
DisplayMapComposable
?
s
Since that composable takes in
anotherMap
and it changes, then yeah it should recompose, why wouldn't it?
187 Views