From f5441c7992eb265496c070c250a0852b07545c02 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Mon, 20 Apr 2026 10:42:39 -0700 Subject: [PATCH] Fix sync buttons showing on undiscovered LB/Last.fm playlists The standalone mode handler ran every 10s on WebSocket status push and set display='' on all sync buttons matching [id$="-sync-btn"], which removed the display:none that kept undiscovered playlist sync buttons hidden. Now tracks which buttons it hid via a data attribute and only restores those, preserving the hidden state on undiscovered playlists. --- webui/static/script.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/webui/static/script.js b/webui/static/script.js index 832e98e8..0e2f217f 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -400,7 +400,15 @@ function handleServiceStatusUpdate(data) { const isSoulsyncStandalone = data.media_server?.type === 'soulsync'; _isSoulsyncStandalone = isSoulsyncStandalone; document.querySelectorAll('.sync-to-server-btn, [id$="-sync-btn"], [onclick*="startPlaylistSync"], [onclick*="syncPlaylistToServer"], [onclick*="startDecadeSync"]').forEach(btn => { - btn.style.display = isSoulsyncStandalone ? 'none' : ''; + if (isSoulsyncStandalone) { + btn.dataset.hiddenByStandalone = '1'; + btn.style.display = 'none'; + } else if (btn.dataset.hiddenByStandalone) { + delete btn.dataset.hiddenByStandalone; + btn.style.display = ''; + } + // If not standalone and not previously hidden by standalone, leave display untouched + // (preserves display:none on undiscovered LB/Last.fm playlist sync buttons) }); // Update enrichment service cards @@ -39743,7 +39751,13 @@ async function fetchAndUpdateServiceStatus() { const isSoulsyncStandalone2 = data.media_server?.type === 'soulsync'; _isSoulsyncStandalone = isSoulsyncStandalone2; document.querySelectorAll('.sync-to-server-btn, [id$="-sync-btn"], [onclick*="startPlaylistSync"], [onclick*="syncPlaylistToServer"], [onclick*="startDecadeSync"]').forEach(btn => { - btn.style.display = isSoulsyncStandalone2 ? 'none' : ''; + if (isSoulsyncStandalone2) { + btn.dataset.hiddenByStandalone = '1'; + btn.style.display = 'none'; + } else if (btn.dataset.hiddenByStandalone) { + delete btn.dataset.hiddenByStandalone; + btn.style.display = ''; + } }); // Update enrichment service cards