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 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 22:21:37 +03:00
parent f507a6cf11
commit 7a4d7149a6

View File

@@ -293,10 +293,21 @@ export function hideOverlaySpinner() {
if (overlay) overlay.remove(); 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) { export function setTabRefreshing(containerId, refreshing) {
const panel = document.getElementById(containerId)?.closest('.tab-panel'); 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) { export function formatUptime(seconds) {