mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 15:25:44 +00:00
fix(editor): preserve completed imports and reset export state
This commit is contained in:
@@ -47,6 +47,7 @@ export function useExportDialogActions({
|
||||
session.setShowExportDropdown(true);
|
||||
session.setExportProgress(null);
|
||||
session.setExportError(null);
|
||||
session.setExportedFilePath(undefined);
|
||||
}, [videoPath, session]);
|
||||
|
||||
const resolveCurrentSettings = useCallback(
|
||||
|
||||
@@ -120,10 +120,15 @@ export function useRecordingLibrary(
|
||||
let insertAt = Math.min(before.length, Math.max(0, index ?? before.length));
|
||||
const addedZooms: ZoomRegion[] = [];
|
||||
let id = "";
|
||||
let completed = 0;
|
||||
for (const path of [...new Set(typeof paths === "string" ? [paths] : paths)]) {
|
||||
if (cancelled.current) return;
|
||||
if (cancelled.current) break;
|
||||
const result = await window.electronAPI.importRecording(sourcePath, path, webcam);
|
||||
if (!result.success) throw new Error(result.error);
|
||||
if (!result.success) {
|
||||
if (cancelled.current) break;
|
||||
throw new Error(result.error);
|
||||
}
|
||||
completed++;
|
||||
if (current.current.project.videoSourcePath !== source)
|
||||
throw new Error(
|
||||
"The project changed while importing. Add the recordings again.",
|
||||
@@ -174,7 +179,7 @@ export function useRecordingLibrary(
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!media || cancelled.current) return;
|
||||
if (!media) return;
|
||||
const { project, timeline, ui, appearance } = current.current;
|
||||
if (project.videoSourcePath !== source)
|
||||
throw new Error("The project changed while importing. Add the recordings again.");
|
||||
@@ -202,9 +207,9 @@ export function useRecordingLibrary(
|
||||
ui.setIsPreviewReady(false);
|
||||
ui.setPreviewVersion((version) => version + 1);
|
||||
toast.success(
|
||||
typeof paths === "string"
|
||||
completed === 1
|
||||
? "Video added to timeline"
|
||||
: `${paths.length} videos added to timeline`,
|
||||
: `${completed} videos added to timeline`,
|
||||
);
|
||||
} catch (error) {
|
||||
if (!cancelled.current) toast.error(`Could not add video: ${String(error)}`);
|
||||
|
||||
@@ -121,9 +121,10 @@ export function useProjectOpenActions({
|
||||
}
|
||||
|
||||
const sourcePath = fromFileUrl(result.path);
|
||||
await window.electronAPI.setCurrentVideoPath(sourcePath, {
|
||||
const setPathResult = await window.electronAPI.setCurrentVideoPath(sourcePath, {
|
||||
preserveProjectPath: false,
|
||||
});
|
||||
if (!setPathResult.success) throw new Error("Could not load media");
|
||||
const sourceVideoUrl = await resolveVideoUrl(sourcePath);
|
||||
try {
|
||||
videoPlaybackRef.current?.pause();
|
||||
|
||||
Reference in New Issue
Block a user