Skip to content

fix(dia.Paper): handle element removal during pointer events#3151

Merged
kumilingus merged 8 commits intoclientIO:masterfrom
Geliogabalus:pointerup-event-fix
Feb 4, 2026
Merged

fix(dia.Paper): handle element removal during pointer events#3151
kumilingus merged 8 commits intoclientIO:masterfrom
Geliogabalus:pointerup-event-fix

Conversation

@Geliogabalus
Copy link
Contributor

@Geliogabalus Geliogabalus commented Jan 29, 2026

Summary

  • Fixes an issue where removing an element during pointermove or pointerup event handlers would cause errors
  • When findViewByModel() returns null (because the model was removed), falls back to using the original view reference

Problem

When an element is removed from the graph during a pointer event handler (e.g., deleting an element after dragging), subsequent calls to view.pointermove() or view.pointerup() would fail because findViewByModel(view.model) returns undefined for removed models.

Solution

Added a fallback to use the original view reference when findViewByModel() returns falsy:

// Before
view = this.findViewByModel(view.model);

// After
view = this.findViewByModel(view.model) || view;

This change is applied to both pointermove and pointerup handlers in packages/joint-core/src/dia/Paper.mjs.

@Geliogabalus Geliogabalus changed the title fix(dia.Paper): fixed an error when the model was removed in mouseup event fix(dia.Paper): handle element removal during pointer events Jan 30, 2026
Copy link
Contributor

@kumilingus kumilingus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the second test is not removing the element at all.

@kumilingus kumilingus self-requested a review February 4, 2026 11:54
@kumilingus kumilingus merged commit 012288f into clientIO:master Feb 4, 2026
3 checks passed
kumilingus pushed a commit to kumilingus/joint that referenced this pull request Feb 13, 2026
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.

2 participants