From 801e02601fae3151e2dad9024ee210d49dae1a4a Mon Sep 17 00:00:00 2001 From: xRangerDE Date: Mon, 11 May 2026 11:40:26 +0200 Subject: [PATCH] fix: applyTemplatePreset now triggers settings auto-save MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clicking one of the three filename-template preset buttons (Default / Archive / Clipper) in Settings was a half-applied state: the three template inputs (vodFilenameTemplate / partsFilenameTemplate / defaultClipFilenameTemplate) got their .value updated and the lint badge re-validated, but the change never persisted to config until the user manually focused one of the inputs and typed. Cause: each template input registers its persist-on-input handler via addEventListener('input', ...), and programmatic .value = ... does NOT dispatch the input event by HTML spec. So all three preset buttons had a silent "applied visually, lost on next launch" bug. Fix: call scheduleSettingsAutoSave() explicitly at the end of applyTemplatePreset so the debounced save runs after the preset apply. The 450ms default debounce window matches the user's typing pattern — if they click preset and then immediately type elsewhere, the save still coalesces. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/renderer-settings.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/renderer-settings.ts b/src/renderer-settings.ts index df8e868..1640935 100644 --- a/src/renderer-settings.ts +++ b/src/renderer-settings.ts @@ -88,6 +88,11 @@ function applyTemplatePreset(preset: string): void { byId('partsFilenameTemplate').value = selected.parts; byId('defaultClipFilenameTemplate').value = selected.clip; validateFilenameTemplates(); + // Programmatic .value = ... does not trigger the 'input' event the + // template inputs listen on for debounced save, so the preset click + // would otherwise look applied but never persist until the user + // types into one of the inputs. Schedule the save explicitly. + scheduleSettingsAutoSave(); } async function refreshRuntimeMetrics(showLoading = true): Promise {