-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt AbstractTreeRenderer to get re-render behavior #64807
Conversation
Let's drop this pattern and go with the imperative route. I'll submit a new PR for that. |
I've given it another thought and I keep this proposal. Here's why:
Given that (1) we need that cache and (2) we don't want to waste CPU cycles in trees which will never need to rerender elements, I conclude that implementing this at each renderer level is the best approach. |
So that them means |
That's a great point. We simply can't have Let's say we introduce The cache makes sure that not only we iterate at most only on the visible elements but also that we do not need to know at all any list index when the time comes to rerender. If you are worried about the use of |
Let's see how far I get with this |
This adopts the
AbstractTreeRenderer
frommaster
into the two Outline renderers. This base class remembers which elements have been rendered and re-renders them whenever a provided event fires. The event is of typeT | T[] | undefined
meaning:T
only that element will be re-renderedT[]
only those elements will be re-renderedundefined
every rendered element will be re-renderedThe name
AbstractTreeRenderer
(andAbstractListRenderer
) are pretty bad, but I'm lacking ideas for improving it. I'd like the name to convey the fact that they remember rendered elements and trigger re-renderings based on a given event. Any suggestions?@jrieken I left a
TODO@joh
marker for where you can plug in the event which should trigger element re-rendering.