Skip to content

fix(area): preserve clicked selection on re-pick#37

Merged
Ni55aN merged 1 commit into
mainfrom
fix/selector-repick-selected-node
Jul 8, 2026
Merged

fix(area): preserve clicked selection on re-pick#37
Ni55aN merged 1 commit into
mainfrom
fix/selector-repick-selected-node

Conversation

@Ni55aN

@Ni55aN Ni55aN commented Jul 8, 2026

Copy link
Copy Markdown
Member

Description

Fix #33: prevent unnecessary unselect() / re-render when a user clicks a node that is already selected.

Changes in rete-area-plugin:

  • Updated Selector.add(entity, accumulate) behavior for accumulate=false:
    • It now unselects all currently selected entities except the clicked one (identified by label + id), instead of unselecting everything.
    • This avoids the “unselect → select → render again” cycle that was triggered on re-picking an already selected node.
  • Added Selector.unselect(entities) to support targeted unselecting.
  • Added unit tests covering:
    • re-adding the sole selected entity does not call unselect for it
    • reducing multi-selection to a clicked entity when that entity is already selected does not unselect the clicked one

Related Issues

Checklist

  • I have read and followed the contribution guidelines.
  • I have tested my changes locally.
  • I have updated documentation (if necessary).
  • I have added unit tests (and/or E2E tests if applicable).

When selecting without accumulate and the clicked entity is already selected,
we only unselect other entities to prevent unnecessary unselect/re-render.

Fixes #33

Co-authored-by: Cursor <cursoragent@cursor.com>
@Ni55aN Ni55aN merged commit 44ce95a into main Jul 8, 2026
3 of 4 checks passed
@rete-js

rete-js Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rete-js rete-js Bot added the released label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Picking Selected Node Unselects & Selects It

1 participant