Is it possible to reduce the number of recompositions happening for a subset of a composable? 🧵👀
I have a LazyList where items 0-3 present a summarized view of some data and allows the user to edit it. There are about 300 additional items after that, and thats where I run into problems - since its all one list, the entire thing recomposes each time the user edits the top items, and while its blazingly fast, its not fast enough.
It would be a dream to simply split the "top/bottom" portion of the list, such that they can recompose independently from each other - but I dont think thats possible? The data in the bottom items rarely change, but just iterating through & adding them to the LazyList takes up enough time to slow things down.
For reference, my use-case has drag-handles, dragging up/down increment/decrements a value, and the entire list recomposes each time. It takes <10 ms, but since youre actively interacting with it, those 10 ms are very clearly noticeable - and things sort of "fall apart" sometimes, where the 10 ms + 10 ms add up to just lock everything for longer periods (on lower end devices, 1 second or more).
Zach Klippenstein (he/him) [MOD]
11/25/2021, 8:01 PM
Are your item models immutable? When you edit an item, are you emitting a whole new list? If so, one solution might be to make your individual items mutable so you can just edit them directly without emitting a whole new list.
11/26/2021, 6:32 AM
Hey! This was related to my other post, and is a non-issue when thats fixed 😅