Skip to content

perf(canvas): load visible frames first - #645

Open
Thimorrow wants to merge 2 commits into
doop-design:mainfrom
Thimorrow:fix/612-canvas-frame-loading
Open

Thimorrow wants to merge 2 commits into
doop-design:mainfrom
Thimorrow:fix/612-canvas-frame-loading

Conversation

@Thimorrow

Copy link
Copy Markdown

Closes #612.

Load frames in the viewport first, then load offscreen frames in small batches, starting with the closest. Frames keep their live document once loaded, so panning away preserves edits. During a fast zoom-out, briefly pause the queue so the canvas can zoom before starting the newly visible frames.

Exports, keyboard edits, and comment drops can bring a queued frame forward when they need its live document. Undo waits for a keyboard edit in progress before reversing it.

Testing

  • 125 targeted tests passed locally. Browser coverage includes a 160-frame canvas, immediate zoom-out, panning during background loading, SVG exports, undo during loading, and dropping a comment onto an element in a queued frame.
  • Production build, typecheck, lint, and format check passed.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect frame loading and several actions within canvas pages.

Fix placement reads before merging so moves in queued frames do not save the wrong layout.

Findings

  1. P1 Queued moves save wrong layouts ▶
  2. P2 Rendered frames stay unavailable ▶

Summary

This PR starts visible and selected frames first, then loads nearby offscreen frames in smaller batches.

  • The canvas starts visible frames before nearby offscreen frames.
  • Exports and comment drops can use frames still waiting in the queue.
  • Keyboard edits can wait for queued frames before applying.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Viewport or selection changes] --> B[Choose visible and selected frames]
  B --> C[Start a limited batch]
  C --> D[Frame renders its document]
  D --> E[Acknowledge document]
  E --> F[Load nearby offscreen frames]
  G[Export, keyboard edit, or comment drop] --> H[Request queued frame]
  H --> D
Loading

Reviews (1) · Last reviewed commit: "perf(canvas): load visible frames first" · Reviewed by Greptile

Comment thread src/components/Stage.tsx Resolved
Comment thread src/lib/frameBridge.ts Resolved
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

This branch has not been deployed

No deployments
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.

Offscreen iframes delay visible frames on large canvases

1 participant