diff --git a/src/components/shortcut-card.tsx b/src/components/shortcut-card.tsx index fde50dd..74b995d 100644 --- a/src/components/shortcut-card.tsx +++ b/src/components/shortcut-card.tsx @@ -22,7 +22,7 @@ export default function ShortcutCard({ app }: { app: Application }) { res.blob().then((blob) => URL.createObjectURL(blob) as string), ), ); - }, []); // eslint-disable-line react-hooks/exhaustive-deps + }, [app.image]); // eslint-disable-line react-hooks/exhaustive-deps return ( @@ -34,13 +34,13 @@ export default function ShortcutCard({ app }: { app: Application }) { {!error ? ( !loading ? ( ) : ( - + ) ) : (
diff --git a/src/main.tsx b/src/main.tsx index b9f6a8d..bbeae14 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -3,7 +3,6 @@ import { useEffect, StrictMode, lazy, Suspense } from "react"; import ReactDOM from "react-dom/client"; // libraries import localforage from "localforage"; -import { libcurl } from "libcurl.js/bundled"; // css import "@/index.css"; // routes @@ -44,17 +43,6 @@ export default function App() { ); } }, []); - useEffect(() => { - const handleLibcurlLoad = () => { - libcurl.set_websocket( - `${location.protocol.replace("http", "ws")}//${location.hostname}:${location.port}/wisp/`, - ); - console.log("\x1b[34;49;1m[Ephemeral] \x1B[32mINFO: Libcurl.js ready!"); - }; - document.addEventListener("libcurl_load", handleLibcurlLoad); - return () => - document.removeEventListener("libcurl_load", handleLibcurlLoad); - }, []); localforage.config({ driver: localforage.INDEXEDDB, name: "ephemeral", diff --git a/src/routes.tsx b/src/routes.tsx index fd20af5..d5399bb 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -1,3 +1,4 @@ +import { useEffect } from "react"; import { createBrowserRouter, RouterProvider, json } from "react-router-dom"; // layouts import RootLayout from "@/root-layout"; @@ -9,6 +10,8 @@ import Settings from "@/pages/Settings"; import Apps from "@/pages/Apps"; import ServiceWorkerError from "@/pages/ServiceWorkerError"; import Error from "@/pages/error"; +// libcurl +import { libcurl } from "libcurl.js/bundled"; const routes = createBrowserRouter([ { Component: RootLayout, @@ -52,5 +55,17 @@ const routes = createBrowserRouter([ ], }, ]); -const AppRoutes = () => ; -export default AppRoutes; +export default function AppRoutes() { + useEffect(() => { + const handleLibcurlLoad = () => { + libcurl.set_websocket( + `${location.protocol.replace("http", "ws")}//${location.hostname}:${location.port}/wisp/`, + ); + console.log("\x1b[34;49;1m[Ephemeral] \x1B[32mINFO: Libcurl.js ready!"); + }; + document.addEventListener("libcurl_load", handleLibcurlLoad); + return () => + document.removeEventListener("libcurl_load", handleLibcurlLoad); + }, []); + return ; +} diff --git a/vite.config.ts b/vite.config.ts index d13a88a..fad0035 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,7 +12,7 @@ const __dirname = path.resolve(); export default defineConfig({ build: { target: "ES2022", - chunkSizeWarningLimit: 2500, + chunkSizeWarningLimit: 2700, }, plugins: [ viteStaticCopy({