Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+19
@@ -0,0 +1,19 @@
|
||||
import type { LoaderFunctionArgs } from "react-router";
|
||||
import { loadDashboardStreamSnapshot } from "~/services/dashboard/dashboard.server";
|
||||
import { eventStream } from "~/utils/stream/event-stream";
|
||||
|
||||
export async function loader({ request, params }: LoaderFunctionArgs) {
|
||||
return eventStream(request.signal, (send) => {
|
||||
let closed = false;
|
||||
void loadDashboardStreamSnapshot({ request, params }).then((snapshot) => {
|
||||
if (!closed) send({ event: "dashboard.snapshot", data: JSON.stringify(snapshot) });
|
||||
});
|
||||
const heartbeat = setInterval(() => {
|
||||
send({ event: "dashboard.heartbeat", data: JSON.stringify({ at: new Date().toISOString() }) });
|
||||
}, 30_000);
|
||||
return () => {
|
||||
closed = true;
|
||||
clearInterval(heartbeat);
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user