From 7a4d7149a605f90f18a26bdef780c4f440449f1c Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Wed, 25 Feb 2026 22:21:37 +0300 Subject: [PATCH] Debounce tab refresh indicator to prevent green line flash The refreshing bar was briefly visible during quick tab switches and auto-refreshes. Delay adding the .refreshing class by 400ms so loads that complete quickly never show the bar at all. Co-Authored-By: Claude Opus 4.6 --- server/src/wled_controller/static/js/core/ui.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server/src/wled_controller/static/js/core/ui.js b/server/src/wled_controller/static/js/core/ui.js index d9dd07a..89fb656 100644 --- a/server/src/wled_controller/static/js/core/ui.js +++ b/server/src/wled_controller/static/js/core/ui.js @@ -293,10 +293,21 @@ export function hideOverlaySpinner() { if (overlay) overlay.remove(); } -/** Toggle the thin loading bar on a tab panel during data refresh. */ +/** Toggle the thin loading bar on a tab panel during data refresh. + * Delays showing the bar by 400ms so quick loads never flash it. */ +const _refreshTimers = {}; export function setTabRefreshing(containerId, refreshing) { const panel = document.getElementById(containerId)?.closest('.tab-panel'); - if (panel) panel.classList.toggle('refreshing', refreshing); + if (!panel) return; + if (refreshing) { + _refreshTimers[containerId] = setTimeout(() => { + panel.classList.add('refreshing'); + }, 400); + } else { + clearTimeout(_refreshTimers[containerId]); + delete _refreshTimers[containerId]; + panel.classList.remove('refreshing'); + } } export function formatUptime(seconds) {