-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Do you want to request a feature or report a bug?
Feature.
The proposed idea is to dynamically render content within slate. This means that slate would only render visible blocks and not render blocks hidden within the y-overflow. The benefits that this would provide for performance are huge. By far the slowest part of the initial render is mounting all of the components (if I'm reading the timeline correctly). You could effectively bound the number of dom nodes rendered at any given time and perhaps find other optimizations as a result.
What's the current behavior?
All of the components are rendered.
What's the desired behavior?
Only visible (with a given padding of elements to support smooth scrolling
The Ace Editor: https://github.com/ajaxorg/ace
Does this by rendering two divs: a full height "scroller" div and then a "content" div that dynamic adjusts based on scrolls while updating it's content (removing hidden dom nodes and adding newly shown dom nodes).
Here's how the position of the content div updates: https://github.com/ajaxorg/ace/blob/master/lib/ace/virtual_renderer.js#L838
Here's how it calculates the properties of the content div: https://github.com/ajaxorg/ace/blob/master/lib/ace/virtual_renderer.js#L1025
Here's an example of dynamic rendering in react: https://github.com/clauderic/react-tiny-virtual-list
