Skip to content

fix(joint-router-avoid): fire idle after incremental main-thread changes - #3489

Open
kumilingus wants to merge 1 commit into
clientIO:masterfrom
kumilingus:fix/router-avoid-main-thread-idle
Open

fix(joint-router-avoid): fire idle after incremental main-thread changes#3489
kumilingus wants to merge 1 commit into
clientIO:masterfrom
kumilingus:fix/router-avoid-main-thread-idle

Conversation

@kumilingus

Copy link
Copy Markdown
Contributor

Description

RouterService emits idle when its provider triggers processed — but MainThreadProvider only triggered processed inside sync(). With worker: false, idle therefore fired after the initial sync / routeAll() and never again after ordinary graph changes (element moves, link edits). WorkerProvider posts processed after every debounce batch, so worker mode behaves as documented; the main-thread incremental paths now match it.

Changes

  • The incremental paths (setShape / setConnector / deleteShape / deleteConnector) run through a shared processTransaction() helper that runs the pass and triggers processed.
  • setConnector's loose-end deletion forwards the process flag — previously a batched sync() could run (and announce) a transaction mid-batch through that branch.

Tests

TDD — both written first and watched fail: an element move fires idle, a link removal fires idle (main-thread provider, synchronous assertion). 30/30 passing; lint clean. Changeset: @joint/router-avoid patch.

Split out of #3488 (the worker.createWorker feature, against dev) — same source markdown issue, independent defect.

🤖 Generated with Claude Code

MainThreadProvider only triggered 'processed' inside sync(), so the
RouterService 'idle' event fired after the initial sync / routeAll()
and never again after ordinary graph changes with worker: false. The
incremental paths (setShape/setConnector/deleteShape/deleteConnector)
now run through a shared processTransaction() helper that announces
the pass, matching the Worker provider's behaviour.

setConnector's loose-end deletion forwards the 'process' flag, so a
batched sync() no longer processes (and announces) a transaction
mid-batch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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