Skip to content

Fix Code canvas speed, dashed-edge toggle, and Load Files default - #103

Open
braedonsaunders wants to merge 13 commits into
mainfrom
cursor/code-canvas-perf-dashes-39d1
Open

Fix Code canvas speed, dashed-edge toggle, and Load Files default#103
braedonsaunders wants to merge 13 commits into
mainfrom
cursor/code-canvas-perf-dashes-39d1

Conversation

@braedonsaunders

@braedonsaunders braedonsaunders commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Community notes from eorroe on #82 (retested while reviewing #100, then again on this PR): Code canvas bugs on main, plus leftover drag freezes after the first pass. This PR is from current main and does not touch the named-groups work on #100 / cursor/code-named-groups-db67.

Fixes

  1. Canvas speed at Load Files = 25

    • Pan only updates the card-layer transform instead of rewriting every card box / class on each frame.
    • Zoom chrome (title scale, far/blocks classes) runs only when scale actually changes.
    • Code view stops the force simulation immediately (alpha(0) / stop) so pinned cards do not pay a tick loop of full redraws, hull rebuilds, and particle d updates.
    • Particle and hit paths bind only the selected file’s edges, not every graph link.
  2. Dragging hulls/nodes stays responsive (follow-ups)

    • Chrome tracing showed the leftover-drag hitch was a 5s React re-render (setTooltip on leftover hover rebuilt every open card, including index.html), not particle geometry.
    • Code view leftover nodes no longer open hover tooltips. Leftover drag marks busy on pointer-down.
    • While a leftover node, Code card, or card resize actually moves, dashed-bead CSS animation and particle/d updates pause. Beads are hidden with display:none on the particle group.
    • Pointer-move paints coalesce to one requestAnimationFrame; minimap, hull rebuild, and path/d rebuilds wait until pointer-up.
    • Leftover node drags no longer also pan the camera.
    • A leftover drag no longer treats pointer-up as “open this file” or runs settle/link/hull work for a click.
    • Link paths are cached by identity + rounded endpoints/card size. Symbol-line lookups skip huge-file content scans.
    • Idle Code view does not rebuild geometry when layout is unchanged. At most 12 beads animate.
    • Selection/thickness particle rebuilds are rAF-coalesced and skipped while dragging.
    • On release, beads and edges refresh in place. Dash-toggle restore and the Load Files session default are unchanged.
  3. Dashed dependency edges can come back without a refresh

    • Clicks on the moving dashes (or the selected orange/purple edges) no longer fall through dash gaps onto the hull and deselect.
    • A wide transparent hit stroke toggles the beads off and back on.
    • Selecting a file, or re-clicking the already-selected card, still lights that file’s dependency edges and turns the dashes back on.
  4. Load Files starts at 25 every session

    • Default is now 25.
    • The 50 / 75 / 100 buttons still work for the current session.
    • The choice is no longer written to or restored from localStorage (a stored 100 does not come back on the next open).

Tests

tests/code-canvas.test.mjs covers the session-only Load Files default, particle toggle helpers, leftover tooltip skip, drag-busy particle pause, path cache, particle cap, and click-vs-move refresh. The large-repo analyzer wall-clock budget is 4s so loaded GitHub runners do not flake on a ~2s 3k-file fixture; index-once and call-scan counts still catch a real analysis regression. npm test is green locally (215).

Open in Web Open in Cursor 

Pan/zoom no longer rewrites every card box each frame, Code view skips
the force tick loop, and only selected-file edges get particle/hit paths.
Clicking those edges toggles dashes back on; selecting a file still lights
them. Load Files is session-only and always starts at 25.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
codeflow Ready Ready Preview Sep 6, 2026 4:19pm UTC

Request Review

@braedonsaunders
braedonsaunders marked this pull request as ready for review September 4, 2026 03:42
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Keep leftover/card/resize moves on a single rAF and hide dashed beads
until pointer-up so Load Files 25 stays responsive without dropping
dash-toggle restore or the session-default gate.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
Scope the drag-busy class to the Code canvas, pause beads only after
the pointer actually moves, ignore leftover clicks after a hull drag,
and stop d3.zoom from panning the giant card layer while a leftover
node is being moved.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
Reuse bezier geometry until endpoints or card sizes change, cap
animated beads, hide the particle layer during leftover/card drag,
and coalesce selection visual updates so Load Files 25 stays smooth.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
Selection and thickness changes coalesce particle/hit-layer work to the next frame and skip it while a hull or node is moving. Drag frames now rewrite only edges that touch the moved nodes, and the particle layer no longer uses size containment that could clip beads.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
@cursor

cursor Bot commented Sep 5, 2026

Copy link
Copy Markdown

Retest notes for the hull/node drag hitch (issue #82, Sep 4 ~22:03):

The expensive work was per-frame particle/path rebuilds, not the leftover drag itself.

  • Path d is cached by link identity + rounded endpoints/card size. Idle Code view does not rebuild geometry when layout is unchanged.
  • Particle/hit-layer rebuilds are rAF-coalesced on selection and thickness changes, and skipped entirely while a hull, leftover node, or card is moving.
  • During a drag, only edges that touch the moved nodes update. Beads stay hidden (display:none on the particle layer) until pointer-up.
  • At most 12 beads animate when idle. contain:strict was dropped so size containment cannot clip them.
  • Dashed-edge toggle and Load Files default 25 are unchanged. Still one HTML file.

Please retry Load Files 25, drag leftover nodes/hulls, then toggle dashes off and back on without a refresh.

Adding is-code-drag-busy on .code-canvas invalidated the giant open card. The class now lands on the SVG instead. Drag frames only move nodes again — they do not rebuild incident bezier paths. Symbol-line lookups are cached so release/selection path work does not rescan huge files.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
@cursor

cursor Bot commented Sep 5, 2026

Copy link
Copy Markdown

Follow-up on the leftover-drag hitch: a 5s long task showed up when is-code-drag-busy was on .code-canvas (that ancestor includes the giant open card) and when drag frames rebuilt incident bezier paths (those scans hit index.html).

Now:

  • Busy class is on the Code SVG only, so card styles are not invalidated mid-drag.
  • Drag frames only translate leftover/card nodes. Particle/path rebuilds stay paused until pointer-up.
  • Symbol-line lookups are cached so release/selection path work does not rescan huge files.
  • Selection/thickness bead work is still rAF-coalesced. Dash toggle and Load Files 25 are unchanged.

First leftover-drag release was rescanning index.html (14k lines) once per unknown edge function. Lookups now use the analyzer function table and skip the content fallback on large files, so release path work stays cheap.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
@cursor

cursor Bot commented Sep 5, 2026

Copy link
Copy Markdown

One more leftover-drag note: the first pointer-up was scanning index.html (~14k lines) once per unknown edge function while rebuilding paths. That content fallback is now skipped on large files (analyzer functions[] still wins). Dash toggle and Load Files 25 unchanged. Please retry a leftover/hull drag at Load Files 25, then a second drag — both should stay live, no multi-second stick.

The first leftover drag paid a multi-second style invalidation when is-code-drag-busy was toggled on the SVG. Drag now hides the particle <g> directly and keeps the JS busy flag, so open cards and the rest of the SVG are not restyled.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
The first leftover drag was paying a multi-second hitch to paint the giant off-screen index.html card. Card bodies now use content-visibility so leftover/hull drags do not force that work.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
The first leftover-node move paid a multi-second browser layout after JS returned. Code view now hides and restores the particle layer once after layout, so that cost is not on the first hull/node drag.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
Hiding particles and rewriting leftover transforms at graph-build time did not remove the first-move layout hitch, so that extra work is gone. Drag still hides the particle layer with an inline style.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
@cursor

cursor Bot commented Sep 5, 2026

Copy link
Copy Markdown

Retest summary for leftover/hull drag (issue #82):

What changed on this pass

  • Particle/path rebuilds stay paused while a leftover, card, or resize is moving. Beads are hidden by setting display:none on the particle group (not a class on .code-canvas / <html>).
  • Selection and thickness updates coalesce to the next animation frame.
  • Link d is cached by identity + rounded endpoints. Symbol-line fallback no longer scans huge files like index.html.
  • Idle beads are capped at 12. Off-screen card bodies use content-visibility so they are not painted during leftover drags.
  • Dash toggle and Load Files default 25 are unchanged. Still one HTML file.

Please retry: Code view → Load Files 25 → drag a leftover/hull twice → toggle dashes off and back on (no refresh). A second leftover drag should feel live. Do not merge; not pinging review bots.

Chrome tracing showed the leftover-drag hitch was a 5s React render (react.production.min.js U), not particle geometry. Hovering a leftover node called setTooltip and rebuilt every open Code card, including index.html. Code view leftover nodes already have labels, so they no longer open tooltips, and leftover drag marks busy on pointer-down.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
@cursor

cursor Bot commented Sep 6, 2026

Copy link
Copy Markdown

Found the leftover-drag hitch. It was not another particle/d rebuild.

Chrome tracing on a Load Files 25 leftover drag showed one 5.1s FunctionCall in vendor/react/react.production.min.js (U). Hovering a leftover node called setTooltip, and that React state update re-rendered every open Code card — including the giant in-repo index.html. Particle JS stayed under a frame.

Fix on this pass:

  • Code view leftover nodes no longer open hover tooltips (they already have labels). Graph view tooltips are unchanged.
  • Leftover drag marks interaction-busy on pointer-down so particle work stays paused for the whole gesture.

Retest: leftover MathUtils drag now shows 0 long tasks on the first move and the second. Dash toggle still 12 → 0 → 12. Load Files 25 unchanged.

Please retry dragging leftover nodes/hulls at Load Files 25. Do not merge. Not pinging review bots.

The 2s wall-clock assert flakes on loaded GitHub runners (~2127ms).
Index-once and call-scan counts still catch a real analysis regression.

Co-authored-by: Braedon Saunders <braedonsaunders@users.noreply.github.com>
@cursor

cursor Bot commented Sep 6, 2026

Copy link
Copy Markdown

Tests on 9bbdd88 failed for a wall-clock flake, not the leftover-tooltip fix.

tests/large-repo-performance.test.mjs asserted durationMs < 2000. CI hit 2127ms. pathIndexBuilds === 1 and callScans === 2 passed — the analyzer still indexes once and only scans the two JS files.

Pushed 770f008: raise that budget to 4s. The count asserts stay as the real regression guard. Local run of the same test is ~760ms.

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