Does `SnapshotStateList` need to be guarded agains...
# compose
e
Does
SnapshotStateList
need to be guarded against concurrent modifications? e.g.
Copy code
remember {
   derivedStateOf {
    // paging.items is a SnapshotStateList
    paging.items.count { ... }  
  }
}
should I be copying the list before iterating over it in the
derivedStateOf
, or do the semantics of the snapshot system prevent that view of it from being modified concurrently?
s
Generally, no, but it is still possible to iterate and modify the list in the same snapshot
Also
toList
on a snapshot state list is mostly free, since it just returns immutable view into the current list
💡 1
z
e
So there wouldn't be a
ConcurrentModificationException
thrown, but there's no guarantee on what view of the data you'd have?