Hi, adding immutable collection every time I creat...
# compose
p
Hi, adding immutable collection every time I create a compose project is painful. Hope this gets to stable and ship as part of the compose or kotlin standard library sometime soon https://github.com/Kotlin/kotlinx.collections.immutable
r
Another option is to add Kotlin collections (
set
,
map
,
list
) to the Stability configuration file. There are some tradeoffs to this but it's worked nicely in multiple codebases I worked in. @eygraber was the one who convinced me to do this 🙂
💯 2
s
Consider just using collections as is :) I am yet to see a convincing benchmark that proves otherwise
💯 3
☝️ 4
e
@shikasd it might depend on the project. Working on adding Compose to a large legacy project, my concern is that there are cases where mutable lists are used as the backing state. Keeping them unstable would make us miss mutations since the instance remains the same.
s
Welp any change to those lists is not observed either, so you have to always modify some other state to make UI update
e
It depends 😅 The way we're using it, the screen would recompose when the list changes, but the Composable function that receives the list as a parameter would get skipped.