Skip to content

Commit b7cd4f0

Browse files
committed
fix(dashboard): use dynamic import for Hyperspeed in Onboarding to prevent Rolldown crash
1 parent 7e2b1b7 commit b7cd4f0

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

apps/web-dashboard/src/pages/Onboarding.jsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useState, useEffect, lazy, Suspense } from 'react';
22
import { useNavigate, useLocation } from 'react-router-dom';
33
import { useOnboarding } from '../context/OnboardingContext';
44
import { useAuth } from '../context/AuthContext';
@@ -21,7 +21,7 @@ import {
2121
Eye,
2222
EyeOff
2323
} from 'lucide-react';
24-
import Hyperspeed from '../components/Hyperspeed/Hyperspeed';
24+
const Hyperspeed = lazy(() => import('../components/Hyperspeed/Hyperspeed'));
2525

2626
const PRIMITIVE_TYPES = ['String', 'Number', 'Boolean', 'Date'];
2727

@@ -397,21 +397,23 @@ export default function Onboarding() {
397397

398398
{/* Hyperspeed animated background (Lightweight for performance) */}
399399
<div style={{ position: 'absolute', inset: 0, zIndex: 0 }}>
400-
<Hyperspeed effectOptions={{
401-
speedUp: 2,
402-
totalSideLightSticks: 5, // Light weight
403-
lightPairsPerRoadWay: 15, // Light weight
404-
colors: {
405-
roadColor: 0x080808,
406-
islandColor: 0x0a0a0a,
407-
background: 0x000000,
408-
shoulderLines: 0x131318,
409-
brokenLines: 0x131318,
410-
leftCars: [0x10b981, 0x34d399, 0x059669], // Green cars to match theme
411-
rightCars: [0x10b981, 0x34d399, 0x059669],
412-
sticks: 0x10b981,
413-
}
414-
}} />
400+
<Suspense fallback={<div style={{ width: '100vw', height: '100vh', background: '#000000' }} />}>
401+
<Hyperspeed effectOptions={{
402+
speedUp: 2,
403+
totalSideLightSticks: 5, // Light weight
404+
lightPairsPerRoadWay: 15, // Light weight
405+
colors: {
406+
roadColor: 0x080808,
407+
islandColor: 0x0a0a0a,
408+
background: 0x000000,
409+
shoulderLines: 0x131318,
410+
brokenLines: 0x131318,
411+
leftCars: [0x10b981, 0x34d399, 0x059669], // Green cars to match theme
412+
rightCars: [0x047857, 0x059669, 0x10b981], // Green cars to match theme
413+
sticks: 0x10b981,
414+
}
415+
}} />
416+
</Suspense>
415417
<div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.95) 100%)', zIndex: 1 }} />
416418
</div>
417419

0 commit comments

Comments
 (0)