Skip to content

fix: lay out the largest diagrams without crashing, plus phone zoom and large-diagram speed - #59

Merged
hyamero merged 8 commits into
stagingfrom
fix/viewer-scale-and-mobile-zoom
Oct 21, 2026
Merged

hyamero merged 8 commits into
stagingfrom
fix/viewer-scale-and-mobile-zoom

Conversation

@hyamero

@hyamero hyamero commented Oct 21, 2026

Copy link
Copy Markdown
Member

Summary

Follow-ups from the viewer test run: big diagrams on phones, large-diagram layout speed and a crash, and viewer speed at 500 nodes.

 layoutDiagram(draft)
   large = isLarge(draft)                     # > 60 nodes or > 180 edges
+  large: considerModelOrder NONE, thoroughness 1   # model order was most of ELK's time
   createElk(large)
-    Node: in-process ELK                     # ~1 MB stack: dense 500-node graphs overflowed
+    Node, large: worker thread, 256 MB stack
+    Bun, large: in-process on the main thread (its workers have less stack)

 stackmap deliver
+  large: prints "laying out N nodes and M connections; a diagram this size can take a while" first

 viewer
+  opening camera on a phone-width stage: no smaller than 50% (Fit still shows everything)
+  pan/zoom gesture: scene on its own compositor layer while it moves
+  card bodies memoised; no emphasis fade past 60 cards
+  flow trails drawn as the lit sub-path, not the whole edge with a moving dash

Evidence

  • Before: stackmap deliver (Node) on 500 nodes / 1,500 connections → internal error: Maximum call stack size exceeded.
    After: delivered in 7 s. Worst case the schema allows (500 / 2,000, ungrouped): 19 s.

  • Before: new test lays out the largest diagram the schema allows without overflowing the stack fails (timeout on old settings, stack overflow with in-process ELK). After: passes.

  • Viewer, 500 nodes, Chrome trace in headless Chromium (main thread / raster):

    before after
    pan (60 moves) 8.9 s / 34.2 s 1.5 s / 1.6 s
    select 4 cards 0.83 s / 2.1 s 0.35 s / 0.97 s
    play 2 s 0.2 s / 7.1 s 0.35 s / 0.2 s
  • typecheck, all unit tests (core 90, schema 108, viewer 158, layout 726, CLI 49), Bun smoke check, and in the CI Docker image viewer e2e 109/109 with VISUAL=1 and CLI e2e 7/7.

Merge Danger

Door: two-way

Diagrams of 60 nodes or fewer lay out exactly as before (no baseline changed). Larger ones no longer keep the author's node order and may cross a few more edges.

Blast Radius: large-diagrams

Layout and viewer behaviour change only past 60 nodes / 180 edges, plus the opening zoom on phone-width stages. Still open: under Bun, an ungrouped 500-node / 2,000-edge diagram overflows (Bun can't raise its stack); the published CLI runs on Node.

@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stackmap-site Ready Ready Preview Oct 21, 2026 9:32am UTC

@hyamero
hyamero merged commit 61947b8 into staging Oct 21, 2026
7 checks passed
@hyamero
hyamero deleted the fix/viewer-scale-and-mobile-zoom branch October 21, 2026 16:04
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.6.0-rc.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

This branch was successfully deployed

1 active deployment
Preview — 63211810 Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant