Skip to content

Commit 9d71ba0

Browse files
chore: fix package.json, chunk for chart
1 parent 18594c8 commit 9d71ba0

3 files changed

Lines changed: 68 additions & 3 deletions

File tree

package-lock.json

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"react-use": "^17.5.1",
5151
"react-virtualized-auto-sizer": "^1.0.24",
5252
"react-virtuoso": "^4.13.0",
53+
"three": "0.184.0",
5354
"uplot": "^1.6.32",
5455
"use-debounce": "^10.0.3",
5556
"zod": "^4.1.13"
@@ -68,6 +69,7 @@
6869
"@types/node": "^22.7.0",
6970
"@types/react": "^18.3.26",
7071
"@types/react-dom": "^18.3.7",
72+
"@types/three": "^0.184.0",
7173
"@vitejs/plugin-react": "^4.3.1",
7274
"baseline-browser-mapping": "^2.10.29",
7375
"eslint": "^9.11.1",

src/features/Overview/ShredsProgression/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import { Flex } from "@radix-ui/themes";
1+
import { lazy, Suspense } from "react";
2+
import { Box, Flex } from "@radix-ui/themes";
23
import Card from "../../../components/Card";
34
import CardHeader from "../../../components/CardHeader";
4-
import ShredsChartWebGl from "./WebGl/Chart";
55
import { ShredsChartLegend } from "./ShredsChartLegend";
66
import { isFrankendancer } from "../../../client";
77

8+
// Lazy-load so Three.js is split into its own chunk, downloaded only when the
9+
// shreds chart mounts.
10+
const ShredsChartWebGl = lazy(() => import("./WebGl/Chart"));
11+
812
export default function ShredsProgression() {
913
if (isFrankendancer) return;
1014

@@ -16,7 +20,9 @@ export default function ShredsProgression() {
1620
<CardHeader text="Shreds" />
1721
<ShredsChartLegend />
1822
</Flex>
19-
<ShredsChartWebGl height="400px" chartId="overview-shreds-chart" />
23+
<Suspense fallback={<Box height="400px" />}>
24+
<ShredsChartWebGl height="400px" chartId="overview-shreds-chart" />
25+
</Suspense>
2026
</Flex>
2127
</Card>
2228
);

0 commit comments

Comments
 (0)