Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #462.
This commit is contained in:
@@ -53,6 +53,28 @@ export default function DashboardPage(): ReactElement {
|
||||
};
|
||||
}, [workspaceId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!workspaceId) return;
|
||||
|
||||
let cancelled = false;
|
||||
const wsId = workspaceId;
|
||||
|
||||
const interval = setInterval(() => {
|
||||
fetchDashboardSummary(wsId)
|
||||
.then((summary) => {
|
||||
if (!cancelled) setData(summary);
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
console.error("[Dashboard] Refresh failed:", err);
|
||||
});
|
||||
}, 30_000);
|
||||
|
||||
return (): void => {
|
||||
cancelled = true;
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [workspaceId]);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
||||
|
||||
Reference in New Issue
Block a user