import { useEffect, useCallback, useState } from "react"; import type { NextPage } from "next"; import Head from "next/head"; import "mapbox-gl/dist/mapbox-gl.css"; import Map from "../components/Map"; import { WorkerPool, WorkerPoolContext } from "../lib/WorkerPool"; import { DropZone } from "../components/DropZone"; const Home: NextPage = () => { const [workerPool, setWorkerPool] = useState(null); const createWorkerPool = useCallback(async () => { setWorkerPool( await new WorkerPool().init(window.navigator.hardwareConcurrency) ); }, []); useEffect(() => { return () => { if (workerPool) { workerPool.terminateAll(); } }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { createWorkerPool(); }, [createWorkerPool]); return ( <> Modmapper ); }; export default Home;