From 0b1d7a944152c1ba9335ec3525196026554322cc Mon Sep 17 00:00:00 2001 From: AeThex Date: Wed, 15 Apr 2026 01:40:43 +0000 Subject: [PATCH] fix: lazy-load Downloads page to prevent module-level JSX crash in Activity Downloads.tsx has JSX at module initialization (icon fields in const array). Eagerly importing it crashes the entire app in the Discord Activity iframe before the React JSX runtime is ready. Lazy loading defers evaluation until the route is actually navigated to. Co-Authored-By: Claude Sonnet 4.6 --- client/App.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/App.tsx b/client/App.tsx index 44386c20..7d11db04 100644 --- a/client/App.tsx +++ b/client/App.tsx @@ -1,5 +1,5 @@ import "./global.css"; -import { useEffect } from "react"; +import React, { useEffect } from "react"; import { Toaster } from "@/components/ui/toaster"; import { TooltipProvider } from "@/components/ui/tooltip"; @@ -93,7 +93,7 @@ import GameForgeDashboard from "./pages/dashboards/GameForgeDashboard"; import Roadmap from "./pages/Roadmap"; import Trust from "./pages/Trust"; import PressKit from "./pages/PressKit"; -import Downloads from "./pages/Downloads"; +const Downloads = React.lazy(() => import("./pages/Downloads")); import Projects from "./pages/Projects"; import ProjectsAdmin from "./pages/ProjectsAdmin"; import Directory from "./pages/Directory"; @@ -240,7 +240,7 @@ const App = () => ( } /> } /> } /> - } /> + } /> } />