Repository navigation
Conversation
Aymericr
left a comment
There was a problem hiding this comment.
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:
- 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 afterclick(). A longer delay (for example 30 to 60 seconds) is the usual safe choice. Related: theurlemitted onsnapshot:savedis 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. - Other hosts. Since the overlay now always sends a
requestIdandisOverlaySnapshotSaverequires it to be echoed back, any other host of@pascal-app/editorthat emitssnapshot:savedwithout therequestId, or skips captures that carry one (the oldif (cameraData.requestId) returnpattern), will now leave the overlay stuck on "Capturing…". Worth a note in the PR description so host implementers know to echo it. - 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.
|
screenshots added in PR description |
Cover overlapping manual download success/failure and background save events so an unrelated snapshot cannot complete a pending manual shutter. Upstream PR pascalorg#1129 author: Alexandre Angelim (angelim).
Factor the standalone onThumbnailCapture handler into a testable host adapter. Use an injected clock and cover manual success, rejected download, and background thumbnail no-ack through the public EditorProps callback. Original snapshot PR pascalorg#1129 author: Alexandre Angelim (angelim).
Resolve the import conflict in snapshot-capture-overlay.tsx by keeping both sides: SnapshotCaptureFailedEvent from this branch, plus isTypingTarget and the @pascal-app/viewer/ui HUD imports from main. No other changes.
|
Merged main into this branch to resolve the import conflict in snapshot-capture-overlay.tsx (kept both sides); no other changes. |
Aymericr
left a comment
There was a problem hiding this comment.
[Maintainer] LGTM at 4bffaf0
Traced the manual capture path end to end: the overlay tags each shutter press with a requestId, the generator copies captureMode and resolution onto cameraData in all three capture branches (tiled, pipeline, fallback), and scene-loader downloads on captureMode before the requestId early return, so manual captures download and resolve the shutter instead of being dropped. Busy or thrown captures still report snapshot:capture-failed with the id, and the point-ask crop stays ephemeral, so it never reaches the host download path. Screenshots are in the description.
Non-blocking:
- The overlay now only accepts
snapshot:savedwith a matchingrequestId. Any host whoseonThumbnailCapturehandler doesn't emit that event will leave the shutter on "Capturing…" with no timeout. A short timeout that falls back to an error toast would make that failure visible. onThumbnailCaptureis typed=> voidon the generator props whiledeliverSnapshotacceptsvoid | Promise<void>. Widening the prop type would make it clear async hosts are awaited.
This LGTM is conditional on CI going green at this head. Right now only Cursor Bugbot has run; the fork workflows still need maintainer approval.
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 onsnapshot: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
bun install --frozen-lockfileandbun dev --filter=editor --ui=stream, then open a saved project.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)Screenshots / screen recording
Generic demo room; no private house plan is shown.
16:9 capture completed
Error feedback and retry
Optional: attach

snapshot-review-export.webp, the actual downloaded 1920 × 1080 demo image.Checklist
bun devbun checkto verify)mainbranchNote
Medium Risk
Changes the snapshot host contract (requestId correlation and promise rejection) and capture UX; integrators that skip manual captures with requestIds may see a stuck shutter until updated.
Overview
Manual snapshot shutter presses now download a file in the standalone editor instead of only uploading the project thumbnail. A new
downloadSnapshothelper triggers a browser download with a sanitized project-based filename, emitssnapshot:savedonly after the download starts (with a 60s blob URL), andscene-loaderroutes captures withcaptureModethrough that path while background thumbnail autosaves stay on the existing upload route.The snapshot overlay and
isOverlaySnapshotSaveare updated to correlate completion via a per-shutterrequestId: the overlay tracks a pending ID, listens forsnapshot:capture-failed, shows an error with retry, and exits “Saved” only when the matchingsnapshot:savedarrives—so unrelated background captures cannot dismiss the UI. Package README documents the hostonThumbnailCapturecontract for integrators.Reviewed by Cursor Bugbot for commit 4bffaf0. Bugbot is set up for automated code reviews on this repo. Configure here.