Skip to content

fix(dia.ToolsView): keep a tool hidden right after addTools() hidden in async mode - #3521

Merged
MartinKanera merged 1 commit into
clientIO:masterfrom
kumilingus:fix/tools-view-hide-async
Sep 30, 2026
Merged

MartinKanera merged 1 commit into
clientIO:masterfrom
kumilingus:fix/tools-view-hide-async

Conversation

@kumilingus

Copy link
Copy Markdown
Contributor

Description

Calling hide() on a tool right after addTools() has no effect when the tools view update is deferred — an async: true paper, or a frozen paper:

paper.on('element:pointerdown', (elementView) => {
    elementView.addTools(toolsView);
    toolsView.tools[1].hide(); // shown again on the next frame in async mode
});

Cause: the first ToolsView.update() after configure() called blurTool(), which calls show() on every tool that is not explicitly visible. That call was added in #1410 to make tools visible again when a tools view is re-added after being removed mid-focusTool() (e.g. an arrowhead drag interrupted by removeTools() on link:mouseleave, so blurTool() is never called). In sync mode the first update runs inside addTools(), before the user's hide(); in async mode it runs afterwards and undoes it.

Fix: move the reset to where it belongs — ToolView.configure() now resets the explicit visibility synchronously, inside addTools(), and the blurTool() call is dropped from the first update (the update loop already renders every visible tool).

Fixes #1445

Tests

New tests in test/jointjs/dia/linkTools.js (Visibility):

karma:joint: 2117 passed.

Note: a tool whose drag is interrupted keeps its focusOpacity (set by focus(), cleared only by blur()). That is pre-existing and not addressed here.

🤖 Generated with Claude Code

…in async mode

The first update of a tools view called `blurTool()` to make tools visible
again after they had been hidden by `focusTool()` and removed before
`blurTool()` could run (clientIO#1410). In async mode (or a frozen paper) that update
is deferred, so it also un-hid tools the user hid explicitly right after
`addTools()` (clientIO#1445).

Reset the explicit visibility synchronously in `ToolView.configure()` instead,
and drop the `blurTool()` call from the first update.

Fixes clientIO#1445

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved review issues remain, and all approval assessments are positive.

Review effort: Lite
Findings: None

What changed in this PR

Fixes deferred rendering so tools hidden immediately after addTools() remain hidden.

Changes:

  • Reset tool visibility synchronously during configuration.
  • Remove the deferred visibility reset.
  • Add regression tests for sync, async, frozen, and re-add scenarios.
  • Document the patch release.
File Description
packages/​joint-core/​test/​jointjs/​dia/​linkTools.js Adds visibility regression coverage.
packages/​joint-core/​src/​dia/​ToolView.mjs Resets explicit visibility during configuration.
packages/​joint-core/​src/​dia/​ToolsView.mjs Removes deferred visibility reset.
.changeset/​quiet-tools-hide.md Documents the patch release.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@MartinKanera
MartinKanera merged commit 3de3381 into clientIO:master Sep 30, 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.

Manually hidden toolView shown after calling addTools in async mode

3 participants