Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix: resolve type error, formatting, and import order from PR #321

Siddharthae971bc4807d
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx
index c70cc5b15..e33cb0b80 100644
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@ -33,9 +33,9 @@ import PlaybackControls from "./PlaybackControls";
import {
createProjectData,
createProjectSnapshot,
- hasProjectUnsavedChanges,
deriveNextId,
fromFileUrl,
+ hasProjectUnsavedChanges,
normalizeProjectEditor,
resolveProjectMedia,
toFileUrl,
@@ -258,26 +258,26 @@ export default function VideoEditor() {
return null;
}
return createProjectSnapshot(currentProjectMedia, {
- wallpaper,
- shadowIntensity,
- showBlur,
- motionBlurAmount,
- borderRadius,
- padding,
- cropRegion,
- zoomRegions,
- trimRegions,
- speedRegions,
- annotationRegions,
- aspectRatio,
- webcamLayoutPreset,
- webcamMaskShape,
- webcamPosition,
- exportQuality,
- exportFormat,
- gifFrameRate,
- gifLoop,
- gifSizePreset,
+ wallpaper,
+ shadowIntensity,
+ showBlur,
+ motionBlurAmount,
+ borderRadius,
+ padding,
+ cropRegion,
+ zoomRegions,
+ trimRegions,
+ speedRegions,
+ annotationRegions,
+ aspectRatio,
+ webcamLayoutPreset,
+ webcamMaskShape,
+ webcamPosition,
+ exportQuality,
+ exportFormat,
+ gifFrameRate,
+ gifLoop,
+ gifSizePreset,
});
}, [
currentProjectMedia,
@@ -303,10 +303,7 @@ export default function VideoEditor() {
gifSizePreset,
]);
- const hasUnsavedChanges = hasProjectUnsavedChanges(
- currentProjectSnapshot,
- lastSavedSnapshot,
- );
+ const hasUnsavedChanges = hasProjectUnsavedChanges(currentProjectSnapshot, lastSavedSnapshot);
useEffect(() => {
async function loadInitialData() {
diff --git a/src/components/video-editor/projectPersistence.test.ts b/src/components/video-editor/projectPersistence.test.ts
index 82e084f46..fdf5f6668 100644
--- a/src/components/video-editor/projectPersistence.test.ts
+++ b/src/components/video-editor/projectPersistence.test.ts
@@ -68,7 +68,6 @@ describe("projectPersistence media compatibility", () => {
});
});
-
it("creates stable snapshots for identical project state", () => {
const media = {
screenVideoPath: "/tmp/screen.webm",
diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.ts
index 246de623d..cc8b600f3 100644
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@ -408,9 +408,9 @@ export function createProjectData(
export function createProjectSnapshot(
media: ProjectMedia,
- editor: ProjectEditorState,
+ editor: Partial<ProjectEditorState>,
): string {
- return JSON.stringify(createProjectData(media, editor));
+ return JSON.stringify(createProjectData(media, normalizeProjectEditor(editor)));
}
export function hasProjectUnsavedChanges(
@@ -418,8 +418,6 @@ export function hasProjectUnsavedChanges(
baselineSnapshot: string | null,
): boolean {
return Boolean(
- currentSnapshot !== null &&
- baselineSnapshot !== null &&
- currentSnapshot !== baselineSnapshot,
+ currentSnapshot !== null && baselineSnapshot !== null && currentSnapshot !== baselineSnapshot,
);
}