From bf8e1d65b585182444568d73be03a3d320d05909 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 28 Sep 2025 06:36:40 +0000 Subject: [PATCH] fix: move useMemo to top-level to satisfy Hooks order cgen-53cf3167dec34b459df8de253b49fe1f --- client/pages/Onboarding.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/pages/Onboarding.tsx b/client/pages/Onboarding.tsx index ea9b6f36..868add57 100644 --- a/client/pages/Onboarding.tsx +++ b/client/pages/Onboarding.tsx @@ -107,6 +107,17 @@ export default function Onboarding() { const CurrentStepComponent = steps[currentStep].component; + // Precompute decorative particles using useMemo at top-level to avoid hooks in JSX + const particles = useMemo(() => { + if (typeof window === "undefined") return []; + return Array.from({ length: 8 }).map(() => ({ + left: `${Math.floor(Math.random() * 100)}%`, + top: `${Math.floor(Math.random() * 100)}%`, + delay: `${Math.random().toFixed(2)}s`, + duration: `${3 + Math.floor(Math.random() * 2)}s`, + })); + }, []); + const finishOnboarding = async () => { if (!user) { navigate("/login");