Repository navigation
feat(sidebar): optimize multi-select drag state logic - #9202
sachin-thakur-bruno merged 2 commits into
Conversation
…omponent and pass down via props
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. WalkthroughThe sidebar now derives multi-select drag state in ChangesSidebar multi-select drag state
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This refactor centralizes sidebar multi-select drag state and uses current collection state during drops. No concrete current-head merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Drag state flows from the sidebar bright, Comment |
… prevent unnecessary re-renders in CollectionItem
* refactor: migrate multi-select drag state logic from hook to parent component and pass down via props * refactor: replace allCollections selector with direct store access to prevent unnecessary re-renders in CollectionItem
Description
Moves multi-select drag-state computation out of being recomputed independently by every selected sidebar row, into one shared computation passed down via props. Also fixes a couple of Redux selector and drag-and-drop lookup inefficiencies this surfaced along the way.
Problem
Shift-selecting many sidebar rows and dragging them scaled quadratically, since every selected row independently re-walked the entire collection tree to compute its own drag state. A selector meant to cut unrelated re-renders was also silently defeated by a leftover broad subscription right next to it.
Fix
Compute the shared drag-state once in
Sidebar/Collectionsand thread it down throughCollection/CollectionItemvia props instead of per-row hooks. Scoped the collection selector properly, deduped a redundant directory lookup inhandleMultipleCollectionItemsDrop, and removed the now-unused hook.Screenshots
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit