diff --git a/frontend/src/pages/Scans.tsx b/frontend/src/pages/Scans.tsx index 3e38f3ad..0e93cd90 100644 --- a/frontend/src/pages/Scans.tsx +++ b/frontend/src/pages/Scans.tsx @@ -105,7 +105,9 @@ export default function Scans() { if (document.visibilityState === "hidden") { stopPolling(); } else { - loadTasks(); // immediate refresh when tab comes back + abortRef.current?.abort(); + abortRef.current = new AbortController(); + loadTasks(); startPolling(); } } @@ -114,7 +116,10 @@ export default function Scans() { return () => { stopPolling(); - abortRef.current?.abort(); + if (abortRef.current) { + abortRef.current.abort(); + abortRef.current = null; + } document.removeEventListener("visibilitychange", handleVisibilityChange); }; }, [filter, page]); @@ -709,4 +714,4 @@ export default function Scans() { /> ); -} \ No newline at end of file +}