docs(docs): fix cursor handling and hover tip refactor in docs UI components

This commit is contained in:
Prad Nukala committed 2026-10-05 11:23:57 -04:00
1 parent 0d066b8104
commit 7ead021ee2
5 files changed
+24 -18

No files matched your search

+6 -4
View File
@@ -66,10 +66,12 @@ let request: Promise<Stats | null> | undefined;
export function useStats(): Load {
const [load, setLoad] = useState<Load>({ phase: "loading" });
useEffect(() => {
request ??= fetch(`${API_BASE}/api/stats`)
.then((res) => (res.ok ? res.json() : null))
.then((body: unknown) => (isStats(body) ? body : null))
.catch(() => null);
if (!request) {
request = fetch(`${API_BASE}/api/stats`)
.then((res) => (res.ok ? res.json() : null))
.then((body: unknown) => (isStats(body) ? body : null))
.catch(() => null);
}
let live = true;
request.then((stats) => {
if (live) setLoad(stats ? { phase: "ready", stats } : { phase: "error" });