From ae971bc4807d560f926b224cef77ec538d8ddbf2 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Sun, 5 Apr 2026 11:00:41 -0700 Subject: [PATCH] fix: resolve type error, formatting, and import order from PR #321 --- src/components/video-editor/VideoEditor.tsx | 47 +++++++++---------- .../video-editor/projectPersistence.test.ts | 1 - .../video-editor/projectPersistence.ts | 8 ++-- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx index c70cc5b..e33cb0b 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 82e084f..fdf5f66 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 246de62..cc8b600 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, ): 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, ); }