From 0f1e04a5471b14348d54d1504e89e092a937895e Mon Sep 17 00:00:00 2001 From: wiiiii123 Date: Tue, 21 Apr 2026 21:05:36 +0700 Subject: [PATCH] fix(recording): always clean up failed starts --- src/hooks/useScreenRecorder.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts index 20c178db..daf88c0f 100644 --- a/src/hooks/useScreenRecorder.ts +++ b/src/hooks/useScreenRecorder.ts @@ -1300,9 +1300,14 @@ export function useScreenRecorder(): UseScreenRecorderReturn { : "Failed to start recording", ); setRecording(false); - await window.electronAPI?.setRecordingState(false); - cleanupCapturedMedia(); - await stopWebcamRecorder(); + try { + await window.electronAPI?.setRecordingState(false); + } catch (stateError) { + console.warn("Failed to reset main-process recording state:", stateError); + } finally { + cleanupCapturedMedia(); + await stopWebcamRecorder(); + } } finally { startInFlight.current = false; setStarting(false);