Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(chrome-extension): reset a recording phase left by a failed start

ManthanNimodiyaa4204c6adda5
diff --git a/apps/chrome-extension/src/offscreen/recorder.ts b/apps/chrome-extension/src/offscreen/recorder.ts
index 2696dd36d..c72bc9d2e 100644
--- a/apps/chrome-extension/src/offscreen/recorder.ts
+++ b/apps/chrome-extension/src/offscreen/recorder.ts
@@ -1174,9 +1174,12 @@ const startRecording = async (request: StartRecordingRequest) => {
);
await ownedSpool.dispose().catch(() => undefined);
}
- // Reset the "creating" status so later status syncs do not report a
- // phantom in-progress recording.
- if (status.phase === "creating") {
+ // Reset the status this attempt set so later status syncs do not report
+ // a phantom in-progress recording. "recording" is already set before
+ // recorder.start(), so a throw there would otherwise leave a capture
+ // phase with no session behind it: stop becomes a no-op and the idle
+ // self-close never fires.
+ if (status.phase === "creating" || status.phase === "recording") {
status = isUserCancellationError(error)
? { phase: "idle" }
: {