From f47ff4ac003714744c90fdb63ebfd394483b0e45 Mon Sep 17 00:00:00 2001 From: "vitalii.semianchuk" Date: Fri, 3 Jul 2026 13:37:25 +0100 Subject: [PATCH] fix: duplicate regex in prune, redundant cloning in undo/redo, typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - pruneAutoRecordings had an inline regex that duplicated the logic from isAutoRecordingPath — if one gets updated without the other, wrong files get pruned. replaced with a call to isAutoRecordingPath. - undo/redo were cloning snapshots 3 times each when 2 is sufficient. reduced the redundant clone to avoid the extra structuredClone cost on every undo/redo operation. - fixed "seperate" → "separate" in audioFilters comment --- electron/ipc/recording/audioFilters.ts | 2 +- electron/ipc/recording/prune.ts | 2 +- src/components/video-editor/editorHistory.ts | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/electron/ipc/recording/audioFilters.ts b/electron/ipc/recording/audioFilters.ts index b465f5f20..51ab6185c 100644 --- a/electron/ipc/recording/audioFilters.ts +++ b/electron/ipc/recording/audioFilters.ts @@ -32,7 +32,7 @@ export function getBrowserMicSidecarFilters(profile?: string | null) { return BROWSER_MIC_SIDECAR_FILTERS; } -export const RECORDING_AUDIO_SIDECAR_DEBUG_ENV = "RECORDLY_KEEP_RECORDING_AUDIO_SIDECARS"; // not used yet, because we need to have seperate audio files for system and mic for each recording +export const RECORDING_AUDIO_SIDECAR_DEBUG_ENV = "RECORDLY_KEEP_RECORDING_AUDIO_SIDECARS"; // not used yet, because we need to have separate audio files for system and mic for each recording export function shouldKeepRecordingAudioSidecars(env: NodeJS.ProcessEnv = process.env) { const value = env[RECORDING_AUDIO_SIDECAR_DEBUG_ENV]?.trim().toLowerCase(); diff --git a/electron/ipc/recording/prune.ts b/electron/ipc/recording/prune.ts index d8004bd14..6c8024502 100644 --- a/electron/ipc/recording/prune.ts +++ b/electron/ipc/recording/prune.ts @@ -127,7 +127,7 @@ export async function pruneAutoRecordings(exemptPaths: string[] = []) { const entries = await fs.readdir(recordingsDir, { withFileTypes: true }); const autoRecordingStats = await Promise.all( entries - .filter((entry) => entry.isFile() && /^recording-.*\.(mp4|mov|webm)$/i.test(entry.name)) + .filter((entry) => entry.isFile() && isAutoRecordingPath(entry.name)) .map(async (entry) => { const filePath = path.join(recordingsDir, entry.name); const stats = await fs.stat(filePath); diff --git a/src/components/video-editor/editorHistory.ts b/src/components/video-editor/editorHistory.ts index 43b7398b8..6ef4c69e2 100644 --- a/src/components/video-editor/editorHistory.ts +++ b/src/components/video-editor/editorHistory.ts @@ -137,8 +137,9 @@ export function undoEditorHistoryStack( } stack.future.push(cloneEditorHistorySnapshot(current)); - stack.current = cloneEditorHistorySnapshot(previous); - return cloneEditorHistorySnapshot(previous); + const clonedPrevious = cloneEditorHistorySnapshot(previous); + stack.current = clonedPrevious; + return cloneEditorHistorySnapshot(clonedPrevious); } export function redoEditorHistoryStack( @@ -156,6 +157,7 @@ export function redoEditorHistoryStack( } stack.past.push(cloneEditorHistorySnapshot(current)); - stack.current = cloneEditorHistorySnapshot(next); - return cloneEditorHistorySnapshot(next); + const clonedNext = cloneEditorHistorySnapshot(next); + stack.current = clonedNext; + return cloneEditorHistorySnapshot(clonedNext); }