Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Conversation

@artemtam
Copy link

@artemtam artemtam commented Jan 22, 2026

Updated unselectNodesAndEdges so it changes only those nodes and edges that are selected and skips those that are unselected. This prevents re-rendering of all nodes and edges on drag start when selectNodesOnDrag is set to false.

It fixes this performance issue – #1876 (comment):

430323959-87e82400-1103-4cb6-8d12-76fc1589b2e8.mov

@changeset-bot
Copy link

changeset-bot bot commented Jan 22, 2026

πŸ¦‹ Changeset detected

Latest commit: 7b6e46c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@xyflow/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

The changes refactor unselectNodesAndEdges in packages/react/src/store/index.ts. The implementation replaces map-based construction of node and edge change lists with explicit loops, adds guards to skip unselection for items not currently selected, and explicitly marks internal nodes unselected before generating changes. Node and edge change arrays are now built via iterative pushes. The function still triggers node and edge change updates, but only for items that were previously selected. No exported or public entity signatures were modified.

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Title check βœ… Passed The title accurately summarizes the main change: preventing unnecessary updates when selectNodesOnDrag is false, which directly addresses the core objective.
Linked Issues check βœ… Passed The PR successfully addresses issue #1876 by modifying unselectNodesAndEdges to skip unselection for items that are not selected, preventing unwanted deselection when dragging with selectNodesOnDrag=false.
Out of Scope Changes check βœ… Passed All changes are focused on the unselectNodesAndEdges function and a changeset entry, directly addressing the linked issue without introducing unrelated modifications.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check βœ… Passed The PR description clearly explains the change (updating unselectNodesAndEdges to skip unselected items) and directly addresses the performance issue it fixes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant