feat : overwite buzz.sudloh.com/guide
This commit is contained in:
@@ -5,13 +5,14 @@ import { useEffect } from "react";
|
||||
|
||||
import { parseInvalidationEvent } from "@/lib/events/invalidation";
|
||||
import { createRefreshScheduler } from "@/lib/events/refresh";
|
||||
import { withBasePath } from "@/lib/base-path";
|
||||
|
||||
export function LiveRefresh({ endpoint }: { endpoint: string }) {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
const scheduler = createRefreshScheduler(() => router.refresh());
|
||||
const source = new EventSource(endpoint);
|
||||
const source = new EventSource(withBasePath(endpoint));
|
||||
const connected = () => scheduler.connected();
|
||||
const notified = (message: Event) => {
|
||||
if (!(message instanceof MessageEvent) || typeof message.data !== "string") {
|
||||
|
||||
Reference in New Issue
Block a user