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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user