Skip to content

editor: download snapshots and complete capture feedback - #1129

Open
angelim wants to merge 2 commits into
pascalorg:mainfrom
angelim:fix/snapshot-download
Open

angelim wants to merge 2 commits into
pascalorg:mainfrom
angelim:fix/snapshot-download

Conversation

@angelim

@angelim angelim commented Oct 23, 2026 •

Copy link
Copy Markdown

What does this PR do?

In the standalone editor, clicking the snapshot shutter captured an image but only uploaded it as the project's thumbnail. The host never emitted snapshot:saved, leaving the overlay on “Capturing…” without exporting a file.

Download user snapshots with a project-based filename and the image's actual extension, then acknowledge completion so the overlay shows “Saved” and exits. Keep automatic thumbnail uploads on their existing path. Correlate shutter requests with save/failure events so unrelated captures cannot complete the overlay, and show capture/download failures while enabling retry.

Host integration: the overlay now supplies a cameraData.requestId; hosts must process manual captures before skipping background request IDs and echo the exact ID on snapshot:saved. Return/reject the capture callback promise so failures can reach the overlay. See the package README's Snapshot completion section.

URL lifetime: the standalone download's blob URL remains valid for 60 seconds, then is revoked. It is a temporary download URL, not persistent image storage. A regression test covers deferred cleanup.

Thumbnail behavior: intentionally, a manual snapshot downloads without replacing the project's thumbnail. Background thumbnail captures continue to upload as before.

How to test

  1. Run bun install --frozen-lockfile and bun dev --filter=editor --ui=stream, then open a saved project.
  2. Open Command+K → Take Snapshot, select Standard 16:9, and press the shutter. A 1920 × 1080 WebP should download; the overlay should show “Saved” and exit.
  3. Repeat with Standard 9:16. Verify a 1080 × 1920 image downloads. Choose the desired levels explicitly; Whole building includes the roof.
  4. Check that ordinary background thumbnail saves do not download files. Capture/download failures should display an error and enable another attempt.

Validation completed:

  • bun run check (passes with existing repository warnings)
  • bun run check-types (all 13 tasks passed)
  • bun run build --filter=editor^... (all six dependency builds passed)
  • bun test apps/editor/lib/snapshot-download.test.ts packages/editor/src/components/editor/snapshot-capture.test.ts packages/editor/src/components/editor/thumbnail-generator.test.ts (47 tests passed)
  • Browser verification: 16:9 and 9:16 downloads decoded at the expected dimensions, capture mode exited, and the browser console had no errors.

Screenshots / screen recording

Generic demo room; no private house plan is shown.

16:9 capture completed

snapshot-review-saved

Error feedback and retry

snapshot-review-error

Optional: attach snapshot-review-export.webp, the actual downloaded 1920 × 1080 demo image.
snapshot-review-export

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

Note

Medium Risk
Changes the thumbnail/snapshot host contract and event correlation; hosts that skip manual captures or omit requestId handling could see stuck overlays or missing downloads.

Overview
Manual snapshot captures in the standalone editor now download a file (sanitized project name + timestamp + correct extension) instead of only uploading the scene thumbnail, and emit snapshot:saved with the shutter’s requestId so the capture overlay can finish.

The snapshot overlay assigns a requestId per shutter press, completes only on a matching snapshot:saved, and shows errors from snapshot:capture-failed so failed downloads/saves allow retry. isOverlaySnapshotSave now requires that ID match (background thumbnail events no longer dismiss the overlay). Host integration is documented in the editor README; downloadSnapshot revokes blob URLs after 60s.

Reviewed by Cursor Bugbot for commit e954e86. Bugbot is set up for automated code reviews on this repo. Configure here.

@Aymericr Aymericr added bug Something isn't working bot:bugs labels Oct 23, 2026 — with Cursor

@Aymericr Aymericr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, @angelim! The fix is well scoped and the plumbing checks out: tagging the shutter with a requestId lets the existing runSnapshotCapture failure path report back to the overlay, and keeping background thumbnails on the upload path makes sense. The tests are nice too.

One blocker before we can merge:

  • Screenshots or a short screen recording. This changes visible behavior (the download, the "Saved" state, and the new error message), so please add a quick clip or screenshots of a 16:9 capture finishing and of the error state.

A few smaller things worth a look:

  1. Revoking the object URL at 0 ms in downloadImage. Some browsers (Safari and Firefox in particular) can cancel or fail the download if the blob URL is revoked right after click(). A longer delay (for example 30 to 60 seconds) is the usual safe choice. Related: the url emitted on snapshot:saved is already revoked by the time anyone reads it, so listeners can't use it. Either keep it alive or document that it's informational only.
  2. Other hosts. Since the overlay now always sends a requestId and isOverlaySnapshotSave requires it to be echoed back, any other host of @pascal-app/editor that emits snapshot:saved without the requestId, or skips captures that carry one (the old if (cameraData.requestId) return pattern), will now leave the overlay stuck on "Capturing…". Worth a note in the PR description so host implementers know to echo it.
  3. Thumbnail behavior change. Before this, a manual shutter in the standalone editor also updated the project thumbnail. Now it only downloads. That seems intended from your description, just confirming it is.

Once the screenshots are in I'm happy to take another look.

@angelim

angelim commented Oct 23, 2026

Copy link
Copy Markdown
Author

screenshots added in PR description

@angelim
angelim requested a review from Aymericr October 23, 2026 01:50

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

bot:bugs bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants