There seems to be an issue with the `items` functi...
# compose-desktop
g
There seems to be an issue with the
items
function in LazyListScope. The item content is not re-rendering despite state change. Or perhaps I'm doing something wrong? here is the code https://github.com/recursivelftr/Grim-Locations/blob/master/src/main/kotlin/io/grimlocations/ui/view/component/LocationListComponent.kt#L52
j
not sure if maybe this is variation of what I ran in to in https://kotlinlang.slack.com/archives/C01D6HTPATV/p1622220633211600
g
Seems very similar
I upgraded from an older build also and that's when it started happening
The issue happens intermittently, sometimes it re-renders and other times it doesnt\
I tried it using a foreach loop and the
item
function instead of
items
, same problem. This is a pretty major issue as there does not seem to be any work around
z
It’s smelly to be using a
Set
for the input there. Ordering of elements within a set is not guaranteed. This means your key function could be unstable, and the order of rows in your list is undefined and could randomly switch between compositions.
g
I'll give it a try with a list and see if that fixes the issue
z
It may not if there’s an underlying bug, but it would still be much better to use a list for this for the reasons I mentioned.
(If your actual set implementation is a linkedhashset, then you will get consistent ordering but that’s not guaranteed by the set contract).
g
it looks like kotlin does use linked hashset
for setOf and so on
z
Yep still better to use a list for this though.