⚡ Bolt: Optimize GroupNode child loop performance#2218
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Deploying nodetool with
|
| Latest commit: |
2e57ab4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ff26f584.nodetool.pages.dev |
| Branch Preview URL: | https://bolt-perf-group-node-child-c.nodetool.pages.dev |
|
Code changes reviewed and approved - the GroupNode optimization with combined selector, early exit, and reference caching is correct and well-implemented. However, this PR has merge conflicts (likely in lock files) that prevent merging. Please rebase on latest |
Combines two independent `O(N)` `.some()` iterations over `state.nodes` into a single optimized `for` loop with an early exit. Memoizes the returned object reference to prevent unnecessary component re-renders during React Flow drag updates. Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
Updates package-lock.json in web, electron, and mobile workspaces to resolve `npm error EUSAGE` conflicts during `npm ci` in GitHub Actions. Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
Replaces inline `require` with standard ES6 import and type casting to resolve `@typescript-eslint/no-require-imports` failure. Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
2e57ab4 to
50b05db
Compare
I've rebased the branch on top of the latest |
⚡ Bolt: GroupNode Child Check Performance Optimization
💡 What
Refactored
GroupNode.tsxto combine two separateuseNodessubscriptions into a single optimizedforloop that checks for children and bypassed children simultaneously.🎯 Why
Previously, every
GroupNodeon the canvas subscribed tostate.nodesusing two separate.some()loops.Because ReactFlow updates the
nodesarray reference on every drag frame (60fps), these loops ran continuously during interactions.This caused O(G * N) operations per frame (where G = number of group nodes, N = total nodes), taking up valuable main thread time.
📊 Impact
hasChildrenandsomeChildrenBypassed) are met, further reducing iteration time.🔬 Measurement
Verify by checking the React Profiler during node drag operations with multiple group nodes. The
useNodesselector execution time withinGroupNodewill be significantly reduced.🧪 Testing
cd web && pnpm typecheck: Passed.cd web && pnpm lint: Passed.make test-web: Verified core tests pass.PR created automatically by Jules for task 17338441262491056562 started by @georgi