Skip to content

Announce the removal of connections and node pins right away - #75

Merged
Rn86222 merged 2 commits into
mainfrom
fix-connection-removal-announcement
Nov 14, 2026
Merged

Rn86222 merged 2 commits into
mainfrom
fix-connection-removal-announcement

Conversation

@Rn86222

@Rn86222 Rn86222 commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Fix a crash when a config change drops a connection, and a stale bit width right after a node pin is removed. Both came from the store deleting an item synchronously but announcing it only when the surrounding transaction ends, a few microtasks later.

  • Resizing a display so that its connection is dropped crashed the editor with "Got unexpected undefined" in the connection renderer. The config change emits didUpdate for the display right after dropping the connection, which re-renders the renderer of the connection subscribed to it, while the list of connections still contains it until didUnregister. didUnregister for connections is now emitted as soon as they are deleted. Removing a connection cascades to nothing, so no listener can observe a half-removed state.
  • The bit width cache of node pins was cleared only when the removal of a pin was announced, so e.g. the output of an aggregate node still counted a removed split input pin in the meantime. It is now cleared as soon as the pin is deleted.

Testing

  • Added tests to src/store/nodePin.test.ts that fail without the respective change: the removal of a dropped connection is announced before the config change dropping it, and the output width of an aggregate node excludes a removed input pin right away.

🤖 Generated with Claude Code

Rn86222 and others added 2 commits November 14, 2026 10:52
Resizing a display so that its connection was dropped crashed the
editor with "Got unexpected undefined" in the connection renderer.

A connection was deleted synchronously, but `didUnregister` was only
emitted once the surrounding transaction had ended, a few microtasks
later. A config change emits `didUpdate` for the node right after
dropping the connections it invalidates, which re-renders the renderer
of a connection subscribed to that node. At that point the connection
was gone from the store, while the list of connections, which waits for
`didUnregister`, still contained it.

Emit `didUnregister` for connections as soon as they are deleted.
Removing a connection cascades to nothing, so no listener can observe a
half-removed state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A node pin was deleted synchronously, but the bit widths cached while
it existed were only dropped when its removal was announced at the end
of the transaction. Until then, the bit width of a pin derived from it,
such as the output of an aggregate node whose split input pin was
removed, was still reported with the removed pin counted in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4ef6636
Status: ✅  Deploy successful!
Preview URL: https://bb2acc97.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev
Branch Preview URL: https://fix-connection-removal-annou.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev

View logs

@Rn86222
Rn86222 merged commit 0b6e022 into main Nov 14, 2026
2 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.

1 participant