Skip to content

Use a typed node-label callback for Dagre layer graphs - #5

Merged
alixander merged 1 commit into
mainfrom
alixander/typed-layer-graph-label
Nov 19, 2026
Merged

alixander merged 1 commit into
mainfrom
alixander/typed-layer-graph-label

Conversation

@alixander

Copy link
Copy Markdown
Contributor

Human


AI

Dagre's layer graphs use the source graph's node label whenever they create a node. Assign the existing g.Node method directly to the typed label callback. The public JavaScript-style callback adapter still supports its existing signatures.

This lets D2 run Dagre layout in TinyGo 0.44, whose reflection implementation panics on the adapter's reflect.Type.NumOut call. The resulting diagram JSON and SVG matched the standard-Go build on the D2 fixtures.

Verified with go test ./..., go vet ./..., and a TinyGo build of D2.js.

  • sent from alixander's Codex

@alixander
alixander merged commit 30476a9 into main Nov 19, 2026
2 checks passed
@alixander
alixander deleted the alixander/typed-layer-graph-label branch November 19, 2026 16:52
alixander added a commit to d2lang/d2 that referenced this pull request Nov 19, 2026
Build the browser and Node WebAssembly packages with TinyGo and bundle its matching JavaScript runtime. D2 now uses the typed Dagre callback from d2lang/dagro#5.

- sent from alixander's Codex
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