This was an idea for tree implementation I came up with to try and play well with the way Compose wants us to do things.
The basic idea:
- Maintain a list of every row which is currently visible/expanded
- When you expand a node, add all its children to the list
- When you collapse a node, remove its children (caveat: and their children) from the list
- Rendering nodes is fairly easy because the only thing that varies is the amount of indent and which icon to show
The idea seems sound - adding a million entries to the list is fast enough as to be unnoticeable.