From d44c78c87b374e2243a0bb987749f1af9b7440b5 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sun, 12 Apr 2026 09:31:42 -0700 Subject: [PATCH] Fix music library paths not auto-saving on settings page Dynamic music path inputs were created after auto-save listeners were attached, so typing in them never triggered a save. Now attaches change listeners when creating or rendering path rows. Removing a path also triggers auto-save immediately. --- webui/static/script.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/webui/static/script.js b/webui/static/script.js index a954a9e6..c317dee4 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -6704,9 +6704,13 @@ function renderMusicPaths(paths) { container.innerHTML = paths.map((p, i) => `
- +
`).join(''); + // Attach auto-save to dynamically rendered inputs + container.querySelectorAll('.music-path-input').forEach(input => { + input.addEventListener('change', () => { if (typeof debouncedAutoSaveSettings === 'function') debouncedAutoSaveSettings(); }); + }); } function addMusicPathRow() { @@ -6720,10 +6724,19 @@ function addMusicPathRow() { row.style.marginBottom = '4px'; row.innerHTML = ` - + `; container.appendChild(row); - row.querySelector('input').focus(); + const input = row.querySelector('input'); + input.focus(); + // Auto-save when the user finishes typing a path + input.addEventListener('change', () => { if (typeof debouncedAutoSaveSettings === 'function') debouncedAutoSaveSettings(); }); +} + +function _removeMusicPathRow(btn) { + btn.closest('.music-path-row').remove(); + // Auto-save after removing a path + if (typeof debouncedAutoSaveSettings === 'function') debouncedAutoSaveSettings(); } function collectMusicPaths() {