fix: move useMemo to top-level to satisfy Hooks order
cgen-53cf3167dec34b459df8de253b49fe1f
This commit is contained in:
parent
d0e94523ad
commit
bf8e1d65b5
1 changed files with 11 additions and 0 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue