Repository navigation
perf(tree): flatten rows and window large trees - #62
Merged
Merged
Conversation
Tree rendered nodes recursively, so every expanded node stayed mounted and each expand or selection re-rendered the whole subtree. Rows are now a flat list and only the slice inside the viewport exists. - flattenTree walks the visible nodes once, emitting rows carrying depth, parent index, sibling position and a guideMask, so a row draws its own edge guides without its ancestors being mounted - window rows with @tanstack/react-virtual whenever the tree is given a bounded height; new maxHeight, fillHeight, estimatedRowHeight, overscan and disableVirtualization props - memoise the row component and keep expansion/selection out of context, so a selection re-renders two rows rather than every mounted one - normalise a controlled expandedKeys array into a Set once per real change rather than once per render - roving tabindex with index-based keyboard navigation, scrolling an unmounted target into the window before focusing it - per-row aria-level/posinset/setsize in place of the nested role="group" wrappers, keeping treeitems directly under the tree - a custom expandIcon on a leaf no longer toggles it into expandedKeys - add Tree.childMounting.test.tsx and a 22,620-node LargeTree story
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tree used to render nodes recursively, so every expanded node stayed in the DOM
and each click re-rendered the whole subtree. Rows are now one flat list, and a
tree with a bounded height mounts only the rows in view.
maxHeight,fillHeight,estimatedRowHeight,overscan,disableVirtualizationRisk level: