Skip to content

fix(connectors.jumpover): redraw jumps after an async paper renders the batch - #3633

Merged
Geliogabalus merged 10 commits into
clientIO:masterfrom
kumilingus:fix/jumpover-async-batch
Dec 2, 2026
Merged

Geliogabalus merged 10 commits into
clientIO:masterfrom
kumilingus:fix/jumpover-async-batch

Conversation

@kumilingus

@kumilingus kumilingus commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

With an async paper, the jumpover connector drew jumps at the old crossings of links changed in a batch. With lazy view management, it also created views for links that are not visible.

  • Jumps at old crossings. On batch:stop, the connector requests a CONNECTOR update of every jumpover link. On an async paper, the links still have their updates scheduled, so the flag is merged into them and each link is updated once, in the order its update was scheduled. A link updated before another one read that link's old route. Now, on an async paper, the connector requests an update of an object that the paper updates after the links (dia.Paper now also updates objects that are not views, marked with an internal symbol and implementing confirmUpdate(); internal for now, see dia.Paper: run a function once the scheduled updates are done #3636). The paper does not mount these objects and does not pass them to onViewUpdate(). Until it is updated, the links are drawn without jumps. Then it requests the connector updates of the links with a priority after its own, so the jumps are drawn in the same update, once the routes of all the links are known. It runs with the paper's update loop: not while the paper is frozen, with updateViews(), also when the paper renders silently, and also after a batch that only hides links.
  • Updates with a new priority. dia.Paper read the priorities of the scheduled updates once per update, so the views requested during an update with a priority that had no updates before were updated only in the next one (and updateViews() left them scheduled). The priorities are now read again after each one.
  • Views of hidden links. The views of the other links were looked up with paper.findViewByModel(), which turns the placeholders of links outside the viewport into views. They are now looked up with paper.getCellView(), so a link without a view has no lines to jump over.

Tradeoff: on an async paper, the links changed in a batch are updated twice in the same update (the route, then the jumps). A chain of links connected to other links can be updated after the jumps are computed, and such links may still be drawn with jumps at old crossings.

Test plan

  • New tests in test/jointjs/connectors.js (jumpover connector > async paper):
    • jumps are drawn at the crossings of the links changed in a batch: the example from connectors.jumpover: jumps drawn at outdated crossings with an async paper #3612; the jump at the new crossing after the first render:done, which is triggered once; only the link views are mounted.
    • updateViews() of a frozen paper draws the jumps: no updates are left.
    • onViewUpdate() is called for views only.
    • no views are created for the links that are not visible: lazy view management with hidden links before the visible ones.
    • a frozen paper draws the jumps once it is unfrozen.
    • the jumps are drawn when the paper renders silently.
    • the jumps are redrawn after a batch that only hides a link.
    • the jumps are drawn after a reset that drops the scheduled update.
  • The first three fail without the last commit. Without the fix, the first test fails (the jump at the old crossing y = 100) and so does the hidden link views test (views created for the hidden links).
  • npx grunt shell:rollup-test-bundle karma:joint: 2256 passed.
  • npx eslint on the changed files: clean.
  • Benchmark in headless Chrome (rendering, moving elements, viewport culling, jumpover), median of 11 runs: no difference beyond the noise of the same build compared with itself.

Fixes #3612

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The connector’s completion logic misses unmount-only and silent renders, leaving _jumpOverPending set and jumps stale or missing; both cases need a reliable completion mechanism and regression tests.

1 open issue
What changed in this PR

This PR addresses #3612 by correcting jumpover connector redraw timing on async papers and avoiding creation of hidden link views.

Changes:

  • Defer jump calculations until scheduled rendering completes, drawing affected links without jumps in the meantime.
  • Look up existing link views without initializing hidden ones.
  • Add async-rendering regression tests and patch changesets for both fixes.
File Description
packages/​joint-core/​test/​jointjs/​connectors.js Adds tests for updated crossings and hidden link views.
packages/​joint-core/​src/​connectors/​jumpover.mjs Defers jump redraws and uses non-creating view lookups.
.changeset/​jumpover-hidden-link-views.md Documents the hidden-view fix.
.changeset/​jumpover-async-batch.md Documents the async batch crossing fix.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The auxiliary updater is not disposed during paper teardown, retaining the paper, graph, and detached DOM, while a reset can discard its queued update and leave replacement links permanently without jumps until another batch ends.

2 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the async jumpover rendering fix.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Comment thread packages/joint-core/src/dia/Paper.mjs Resolved
Comment thread packages/joint-core/src/dia/Paper.mjs Resolved
…the links

The updater requests the connector updates of the links with a priority
after its own, and dia.Paper reads the priorities again after each one,
so updateViews() of a frozen paper draws the jumps and render:done is
triggered once per batch.

The paper does not mount the objects that are not views and does not
pass them to onViewUpdate().
@Geliogabalus
Geliogabalus merged commit 0d2fd6b into clientIO:master Dec 2, 2026
3 checks passed
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.

connectors.jumpover: jumps drawn at outdated crossings with an async paper

3 participants