Fix spinner appearing every 5 secds

This commit is contained in:
2026-03-08 18:23:20 -04:00
parent 54c56002ee
commit 4161ff9513
2 changed files with 15 additions and 7 deletions

View File

@@ -8,16 +8,18 @@
// Subscribe to the store
const unsubscribe = pendingRequests.subscribe(count => {
if (count > 0) {
// Only show the spinner if the request takes longer than 300ms
// Only show the spinner if the request takes longer than 1000ms
if (!timer) {
timer = setTimeout(() => {
showSpinner = true;
}, 300);
}, 1000);
}
} else {
// Instantly hide the spinner when all requests finish
clearTimeout(timer);
timer = null;
if (timer) {
clearTimeout(timer);
timer = null;
}
showSpinner = false;
}
});