tad
03/08/2023, 12:19 AMderivedStateOf.
private val list = mutableStateListOf<Thing>()
val sortedList by derivedStateOf {
list.sorted()
}tad
03/08/2023, 12:20 AMderivedStateOf blocks?tad
03/08/2023, 12:47 AMtoList() is intended to be used to get the PersistentList for the current snapshot record, so you can iterate without dealing with concurrent modifications. It's a bit concerning that using standard Kotlin library functions such as map, fold, filter, etc. run the risk of crashing unless this is used. Would it make sense to have iterator() return toList().iterator() instead of the SnapshotStateList's ListIterator implementation?tad
03/08/2023, 2:27 AMMutableList interface's contract that iterator() returns a MutableIterator. Feels like a footgun inherited by Java.efemoney
03/08/2023, 4:06 AMtad
03/08/2023, 4:07 AMefemoney
03/08/2023, 4:09 AMtad
03/08/2023, 4:11 AMlist.toList() to get the underlying immutable list for the snapshotefemoney
03/08/2023, 4:12 AMtoList() version everywhere (i also have a derived sorted list too) so I haven’t run into this. But I agree it should be somewhat clarifiedZach Klippenstein (he/him) [MOD]
03/08/2023, 5:07 PMtad
03/08/2023, 5:09 PMZach Klippenstein (he/him) [MOD]
03/08/2023, 8:52 PMtad
03/08/2023, 9:03 PMtad
03/08/2023, 9:03 PMMutableList instead of a SnapshotStateList.tad
03/08/2023, 9:08 PM