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

Zoltan Demant

08/03/2022, 3:13 PM
*Im rendering a tree of nodes with compose, and I have a hard time understanding if caching can happen for scenarios like this?* Each node has a
@Composable
function that produces a T. For a simple branch with nodes A > B > C; I end up with a scenario where if any of the nodes change, all of them have to produce a new T. Ideally, only affected nodes should reproduce their T, so if B changes, C can remain the same. Any ideas? More details in 🧵
Ive managed to get it working by using molecule, which as far as I understand it creates a separate composition for each node. Im not sure thats a valid approach though, or if its even the way molecule is intended to be used 😅 Basically Id like to remember the result of a
@Composable
call. Is that possible?
8 Views