fix dashboard shit

This commit is contained in:
KingKDot
2026-03-22 22:24:11 -05:00
parent 3a155768a2
commit c854621e03
2 changed files with 9 additions and 5 deletions
+8 -5
View File
@@ -18,6 +18,7 @@ export async function loadWithOptions(options = {}) {
const { force = false, reorder = false } = options;
if (state.isLoading) {
state.pendingForce = state.pendingForce || force;
state.pendingReorder = state.pendingReorder || reorder;
return;
}
state.isLoading = true;
@@ -52,10 +53,12 @@ export async function loadWithOptions(options = {}) {
console.error("load clients", err);
} finally {
state.isLoading = false;
if (state.pendingForce) {
if (state.pendingForce || state.pendingReorder) {
const shouldForce = state.pendingForce;
const shouldReorder = state.pendingReorder;
state.pendingForce = false;
loadWithOptions({ force: shouldForce });
state.pendingReorder = false;
loadWithOptions({ force: shouldForce, reorder: shouldReorder });
}
}
}
@@ -125,7 +128,7 @@ function connectDashboardWs() {
try {
const msg = typeof event.data === "string" ? JSON.parse(event.data) : null;
if (msg && msg.type === "clients_changed") {
loadWithOptions({ force: false });
loadWithOptions({ force: false, reorder: true });
}
} catch {}
};
@@ -157,7 +160,7 @@ function adjustPollingForWs() {
? FALLBACK_POLL_MS
: getConfiguredPollIntervalMs(POLL_INTERVAL_MS);
pollTimer = setInterval(() => {
loadWithOptions({ force: false });
loadWithOptions({ force: false, reorder: true });
}, interval);
}
@@ -168,7 +171,7 @@ export function startAutoRefresh(intervalMs = POLL_INTERVAL_MS) {
: getConfiguredPollIntervalMs(intervalMs);
clearInterval(pollTimer);
pollTimer = setInterval(() => {
loadWithOptions({ force: false });
loadWithOptions({ force: false, reorder: true });
}, effectiveInterval);
}
+1
View File
@@ -9,5 +9,6 @@ export const state = {
lastDigest: "",
isLoading: false,
pendingForce: false,
pendingReorder: false,
thumbnailsRequested: false,
};