Skip to content

fix(paper): preserve pending update flags when cell is hidden during updateViewsBatch#3256

Open
Geliogabalus wants to merge 4 commits intoclientIO:masterfrom
Geliogabalus:paper-cell-visibility-fix
Open

fix(paper): preserve pending update flags when cell is hidden during updateViewsBatch#3256
Geliogabalus wants to merge 4 commits intoclientIO:masterfrom
Geliogabalus:paper-cell-visibility-fix

Conversation

@Geliogabalus
Copy link
Copy Markdown
Contributor

Summary

  • When a mounted view became invisible during updateViewsBatch, the currentFlag (e.g. a translate flag) was discarded — only FLAG_INSERT was stored in the unmounted list via registerUnmountedView
  • When the view was later re-mounted, the pending update was never applied, leaving the view in a stale state (e.g. the transform attribute retained the old position)
  • Fix: move _mergeUnmountedViewScheduledUpdates(cid, currentFlag) outside the else branch so it runs for both the mounted and already-unmounted cases, consistent with how the already-unmounted path already worked

Test plan

  • Run packages/joint-core tests: cd packages/joint-core && grunt test:server --file=test/jointjs/dia/Paper.js
  • New test: 'propagate updates flag when the cell is hidden during the update' — moves a rect to a position that triggers unmount, then re-mounts it and checks the transform attribute reflects the new position

🤖 Generated with Claude Code

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a joint.dia.Paper view-management edge case where scheduled update flags (e.g., translate/transform updates) could be lost when a view becomes hidden during updateViewsBatch, causing stale state when the view is later re-mounted.

Changes:

  • Preserve pending view update flags when a mounted view is unmounted due to cellVisibility during updateViewsBatch.
  • Add a regression test covering “hide during update → re-mount → ensure transform reflects the latest position”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/joint-core/src/dia/Paper.mjs Ensures unmounted-queue scheduled flags are merged even when the view transitions from mounted → unmounted during updateViewsBatch.
packages/joint-core/test/jointjs/dia/Paper.js Adds a QUnit test intended to reproduce and prevent the stale-transform regression.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants