fix(remixer): improve tree build and rendering performance - #904
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves Remixer tree build and rendering performance by stabilizing prop/callback identities and reducing per-node work during tree construction, so unrelated UI updates don’t trigger expensive tree rebuilds.
Changes:
- Memoizes
TreeDndandTreeNodeContainer, and converts row handlers to stableuseCallbackfunctions that read transient state via refs. - Optimizes tree building by pre-indexing children by parent (avoids repeated
currentBook.filter(...)per node). - Stabilizes
RemixerDashboardprops into<TreeDnd>(callbacks + emptypathLevelFormatsfallback) to make memoization effective.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| client/src/components/remixer/RemixerDashboard.tsx | Stabilizes <TreeDnd> props (callbacks and pathLevelFormats) to prevent unnecessary tree rebuilds on unrelated dashboard renders. |
| client/src/components/remixer/BookContent/TreeNodeContainer.tsx | Refactors event handler props to accept page and memoizes the row component to avoid re-rendering unaffected rows. |
| client/src/components/remixer/BookContent/Dashboard.tsx | Adds child indexing + stable row handlers and memoizes TreeDnd to reduce O(n²) work and minimize rerenders during drag/hover/selection changes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+354
to
+358
| // Stable per-row handlers. Each receives the row's `page`, so a single | ||
| // identity serves every row and the memoized `TreeNodeContainer` only | ||
| // re-renders rows whose own (primitive) props actually changed. Transient | ||
| // drag/selection state is read through refs to keep these referentially stable. | ||
| const handleRowDragStart = useCallback( |
yghaemi
approved these changes
Aug 12, 2026
Collaborator
|
🎉 This PR is included in version 2.144.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
memo-izes andrefs various event handlers and components in the Remixer to avoid heavy tree rebuilds and unneeded re-renders