Live
uses document
Makes the page again every every milliseconds while it's shown (not in a tab in the background): for pages of
what's running, which change without the codebase changing.
import { refresh } from "#codebase/tcmts/react"; import { useEffect } from "react"; export function Live({ every = 3000 }: { every?: number }) { useEffect(() => { const timer = setInterval(() => { if (document.visibilityState === "visible") refresh(); }, every); return () => clearInterval(timer); }, [every]); // (an element, if an empty one: a component, which a server component sends to the browser) return <></>; }