I think i found a bug. Not sure. But i do have a m...
# compose
t
I think i found a bug. Not sure. But i do have a modifier that swipes away an element in a list and than removes the item from the list. This modifier remembers the state that the element is removed. Than when i remove the element from the list it looks like that the next element gets the state of this modifier. When i use the key() {} code it works fine.
Copy code
LazyColumn {
    items(modelList) { item ->
        //key(item) { // with key it works fine
            Box(Modifier.swipeToRemove(onRemoved = {
                modelList.remove(item)
            })) {
                Item(item = item)
            }
        //}
    }
}
m
We don't have automatic keys in LazyColumn just yet, it's recommended to use key for such things for now, so you are doing everything right here 🙂
t
ok thx @matvei
a
to elaborate: the position in the list is the key. so when the item with index 2 is removed the item which was previously third is now second and has its state. quite soon we will have an official solution for keys in LazyColumn which would support reordering/removings. just using key{} as you did is not solving all the issues
but works for this case 🙂