import { useEffect, useState } from "preact/hooks"; import { FabricGame, FabricInstaller, FabricLoader } from "../types/fabric.ts"; import { Loader } from "../components/Loader.tsx"; import { Button } from "../components/Button.tsx"; export function FabricVersions() { const [game, setGame] = useState([]); const [installer, setInstaller] = useState([]); const [loader, setLoader] = useState([]); const [isLoading, setIsLoading] = useState(true); const [includeSnapshots, setIncludeSnapshots] = useState(false); useEffect(() => { let poll: number; if (isLoading) { poll = setInterval(async () => { const res = await fetch("/api/fabric"); if (res.status !== 200) return; const json: { gameVersions: FabricGame[]; installerVersions: FabricInstaller[]; loaderVersions: FabricLoader[]; } = await res.json(); setGame(json.gameVersions); setInstaller(json.installerVersions); setLoader(json.loaderVersions); setIsLoading(false); }, 500); } return () => clearInterval(poll); }, [isLoading]); return isLoading ? : (

You probably don't need to change this one.
You probably don't need to change this one.
); }