mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-26 07:45:34 +00:00
Address CodeRabbit lifecycle feedback
This commit is contained in:
+9
-6
@@ -817,12 +817,15 @@ function createEditorWindowWrapper() {
|
||||
if (choice === 0) {
|
||||
editorWindow.webContents.send("request-save-before-close");
|
||||
ipcMain.once("save-before-close-done", (_event, saved: boolean) => {
|
||||
if (saved) {
|
||||
if (process.platform === "win32" && !isAppQuitting) {
|
||||
closeEditorWindowToHud(editorWindow);
|
||||
} else {
|
||||
closeEditorWindowBypassingUnsavedPrompt(editorWindow);
|
||||
}
|
||||
if (!saved) {
|
||||
isAppQuitting = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.platform === "win32" && !isAppQuitting) {
|
||||
closeEditorWindowToHud(editorWindow);
|
||||
} else {
|
||||
closeEditorWindowBypassingUnsavedPrompt(editorWindow);
|
||||
}
|
||||
});
|
||||
} else if (choice === 1) {
|
||||
|
||||
@@ -1745,6 +1745,8 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: The media path intentionally triggers source-specific state reset.
|
||||
useEffect(() => {
|
||||
webcamSynchronizedPathRef.current = null;
|
||||
setWebcamSynchronizedPath(null);
|
||||
setWebcamVideoDimensions(null);
|
||||
lastWebcamSyncTimeRef.current = null;
|
||||
}, [webcamVideoPath]);
|
||||
|
||||
@@ -249,6 +249,13 @@ export function WebcamCropControl({
|
||||
syncPreviewMedia();
|
||||
}, [syncPreviewMedia]);
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: The source identity intentionally resets cached synchronization state.
|
||||
useEffect(() => {
|
||||
synchronizedPreviewSrcRef.current = null;
|
||||
setSynchronizedPreviewSrc(null);
|
||||
setPreviewFrame(null);
|
||||
}, [previewSrc]);
|
||||
|
||||
const commitVisualCrop = (nextVisualCrop: CropRegion, immediate = false) => {
|
||||
const nextCrop = mirrored
|
||||
? flipCropHorizontally(nextVisualCrop)
|
||||
|
||||
@@ -1375,13 +1375,20 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
|
||||
);
|
||||
|
||||
if (webcamPath) {
|
||||
await window.electronAPI.setCurrentRecordingSession({
|
||||
videoPath: finalPath,
|
||||
webcamPath,
|
||||
timeOffsetMs: webcamTimeOffsetMs.current,
|
||||
hideOverlayCursorByDefault:
|
||||
hideEditorOverlayCursorByDefault.current,
|
||||
});
|
||||
try {
|
||||
await window.electronAPI.setCurrentRecordingSession({
|
||||
videoPath: finalPath,
|
||||
webcamPath,
|
||||
timeOffsetMs: webcamTimeOffsetMs.current,
|
||||
hideOverlayCursorByDefault:
|
||||
hideEditorOverlayCursorByDefault.current,
|
||||
});
|
||||
} catch (sessionError) {
|
||||
console.error(
|
||||
"Failed to publish the asynchronously finalized webcam:",
|
||||
sessionError,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return webcamPath;
|
||||
@@ -1395,11 +1402,26 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
|
||||
const muxReadyPromise = isNativeWindows
|
||||
? window.electronAPI.muxNativeWindowsRecording(expectedDurationMs)
|
||||
: Promise.resolve(null);
|
||||
const [webcamPath] = await Promise.all([
|
||||
webcamReadyPromise,
|
||||
microphoneReadyPromise,
|
||||
muxReadyPromise,
|
||||
]);
|
||||
const [webcamResult, microphoneResult, muxResult] =
|
||||
await Promise.allSettled([
|
||||
webcamReadyPromise,
|
||||
microphoneReadyPromise,
|
||||
muxReadyPromise,
|
||||
]);
|
||||
const webcamPath =
|
||||
webcamResult.status === "fulfilled" ? webcamResult.value : null;
|
||||
for (const [taskName, result] of [
|
||||
["webcam", webcamResult],
|
||||
["microphone sidecar", microphoneResult],
|
||||
["Windows mux", muxResult],
|
||||
] as const) {
|
||||
if (result.status === "rejected") {
|
||||
console.error(
|
||||
`[useScreenRecorder] ${taskName} finalization failed:`,
|
||||
result.reason,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
"[useScreenRecorder] Emitting setCurrentRecordingSession with:",
|
||||
|
||||
Reference in New Issue
Block a user