Skip to content

Commit ae971bc

Browse files
fix: resolve type error, formatting, and import order from PR #321
1 parent 2136379 commit ae971bc

3 files changed

Lines changed: 25 additions & 31 deletions

File tree

src/components/video-editor/VideoEditor.tsx

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ import PlaybackControls from "./PlaybackControls";
3333
import {
3434
createProjectData,
3535
createProjectSnapshot,
36-
hasProjectUnsavedChanges,
3736
deriveNextId,
3837
fromFileUrl,
38+
hasProjectUnsavedChanges,
3939
normalizeProjectEditor,
4040
resolveProjectMedia,
4141
toFileUrl,
@@ -258,26 +258,26 @@ export default function VideoEditor() {
258258
return null;
259259
}
260260
return createProjectSnapshot(currentProjectMedia, {
261-
wallpaper,
262-
shadowIntensity,
263-
showBlur,
264-
motionBlurAmount,
265-
borderRadius,
266-
padding,
267-
cropRegion,
268-
zoomRegions,
269-
trimRegions,
270-
speedRegions,
271-
annotationRegions,
272-
aspectRatio,
273-
webcamLayoutPreset,
274-
webcamMaskShape,
275-
webcamPosition,
276-
exportQuality,
277-
exportFormat,
278-
gifFrameRate,
279-
gifLoop,
280-
gifSizePreset,
261+
wallpaper,
262+
shadowIntensity,
263+
showBlur,
264+
motionBlurAmount,
265+
borderRadius,
266+
padding,
267+
cropRegion,
268+
zoomRegions,
269+
trimRegions,
270+
speedRegions,
271+
annotationRegions,
272+
aspectRatio,
273+
webcamLayoutPreset,
274+
webcamMaskShape,
275+
webcamPosition,
276+
exportQuality,
277+
exportFormat,
278+
gifFrameRate,
279+
gifLoop,
280+
gifSizePreset,
281281
});
282282
}, [
283283
currentProjectMedia,
@@ -303,10 +303,7 @@ export default function VideoEditor() {
303303
gifSizePreset,
304304
]);
305305

306-
const hasUnsavedChanges = hasProjectUnsavedChanges(
307-
currentProjectSnapshot,
308-
lastSavedSnapshot,
309-
);
306+
const hasUnsavedChanges = hasProjectUnsavedChanges(currentProjectSnapshot, lastSavedSnapshot);
310307

311308
useEffect(() => {
312309
async function loadInitialData() {

src/components/video-editor/projectPersistence.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ describe("projectPersistence media compatibility", () => {
6868
});
6969
});
7070

71-
7271
it("creates stable snapshots for identical project state", () => {
7372
const media = {
7473
screenVideoPath: "/tmp/screen.webm",

src/components/video-editor/projectPersistence.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,18 +408,16 @@ export function createProjectData(
408408

409409
export function createProjectSnapshot(
410410
media: ProjectMedia,
411-
editor: ProjectEditorState,
411+
editor: Partial<ProjectEditorState>,
412412
): string {
413-
return JSON.stringify(createProjectData(media, editor));
413+
return JSON.stringify(createProjectData(media, normalizeProjectEditor(editor)));
414414
}
415415

416416
export function hasProjectUnsavedChanges(
417417
currentSnapshot: string | null,
418418
baselineSnapshot: string | null,
419419
): boolean {
420420
return Boolean(
421-
currentSnapshot !== null &&
422-
baselineSnapshot !== null &&
423-
currentSnapshot !== baselineSnapshot,
421+
currentSnapshot !== null && baselineSnapshot !== null && currentSnapshot !== baselineSnapshot,
424422
);
425423
}

0 commit comments

Comments
 (0)