https://kotlinlang.org logo
#compose
Title
# compose
m

Matej Drobnič

05/31/2022, 5:28 AM
Hello everyone. Is there a documentation anywhere about how exactly reusing in lazy layouts works behind the scenes? What is reused? Composition still needs to be re-done for every item, right?
This video seems to contain only info I found:

https://youtu.be/1ANt65eoNhQ?t=1223

n

natario1

05/31/2022, 11:36 PM
Not sure about documentation, but what lazy layouts do is allocate a certain number of compose nodes, just like RecyclerView allocates Views. The actual number is an implementation detail but roughly, enough to fill the available space + a few more for prefetching. Only these nodes are composed, not all items in the dataset. Then as you scroll and/or the dataset changes, they are reused and bound to new data.
3 Views