Skip to content

Commit 545d9cd

Browse files
committed
fix(gui): stop Logs auto-refresh from flashing Loading above the table
Keep polling every 2s, but silent background fetches no longer toggle loading or insert a status row that shifts the table.
1 parent db0e95d commit 545d9cd

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎gui/src/pages/Logs.tsx‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ export default function Logs({ apiBase }: { apiBase: string }) {
277277
else if (e.key === "ArrowRight" || e.key === "End") { e.preventDefault(); selectTab("debug"); document.getElementById("logs-tab-debug")?.focus(); }
278278
};
279279

280-
const fetchLogs = useCallback(async () => {
281-
setLoading(true);
280+
const fetchLogs = useCallback(async (opts?: { silent?: boolean }) => {
281+
if (!opts?.silent) setLoading(true);
282282
setError(null);
283283
try {
284284
const res = await fetch(`${apiBase}/api/logs`);
@@ -288,15 +288,15 @@ export default function Logs({ apiBase }: { apiBase: string }) {
288288
const detail = cause instanceof Error ? cause.message : "";
289289
setError(detail ? `${t("logs.loadError")} ${detail}` : t("logs.loadError"));
290290
} finally {
291-
setLoading(false);
291+
if (!opts?.silent) setLoading(false);
292292
}
293293
}, [apiBase, t]);
294294

295295
useEffect(() => {
296296
if (tab !== "logs") return;
297297
void fetchLogs();
298298
if (!autoRefresh) return;
299-
const interval = setInterval(() => void fetchLogs(), 2000);
299+
const interval = setInterval(() => void fetchLogs({ silent: true }), 2000);
300300
return () => clearInterval(interval);
301301
}, [autoRefresh, fetchLogs, tab]);
302302

@@ -402,7 +402,6 @@ export default function Logs({ apiBase }: { apiBase: string }) {
402402
<EmptyState title={t("logs.noRequests")} />
403403
) : (
404404
<>
405-
{loading && <div className="row muted" role="status"><span className="spin" /> {t("common.loading")}</div>}
406405
<div ref={scrollContainerRef} className="tbl-wrap" style={{ overflowY: "auto", maxHeight: "calc(100vh - 260px)" }}>
407406
<table className="tbl logs-table">
408407
<thead style={{ position: "sticky", top: 0, zIndex: 1, background: "var(--surface)" }}>

0 commit comments

Comments
 (0)