fix: lazy-load Downloads page to prevent module-level JSX crash in Activity
Some checks are pending
Build / build (push) Waiting to run
Deploy / deploy (push) Waiting to run
Lint & Type Check / lint (push) Waiting to run
Security Scan / semgrep (push) Waiting to run
Security Scan / dependency-check (push) Waiting to run
Test / test (18.x) (push) Waiting to run
Test / test (20.x) (push) Waiting to run

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 <noreply@anthropic.com>
This commit is contained in:
AeThex 2026-04-15 01:40:43 +00:00
parent 446ad7159c
commit 0b1d7a9441

View file

@ -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 = () => (
<Route path="/roadmap" element={<Roadmap />} />
<Route path="/trust" element={<Trust />} />
<Route path="/press" element={<PressKit />} />
<Route path="/downloads" element={<Downloads />} />
<Route path="/downloads" element={<React.Suspense fallback={null}><Downloads /></React.Suspense>} />
<Route path="/projects" element={<Projects />} />
<Route
path="/projects/admin"