From c68f2c63a9b4c38de707c0c26b00ab984e259104 Mon Sep 17 00:00:00 2001 From: bender Date: Sun, 7 Jun 2026 23:01:15 +0000 Subject: [PATCH] Update src/app/page.tsx --- src/app/page.tsx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 36c459f..ef6386d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -5,15 +5,20 @@ import React, { useState, useMemo } from "react"; import ReactLenis from "lenis/react"; import HeroSplitDualMedia from '@/components/sections/hero/HeroSplitDualMedia'; +// Move the random generation outside the component to ensure purity during render +const generateHeartStyles = () => { + return Array.from({ length: 30 }).map(() => ({ + left: `${Math.random() * 100}vw`, + animationDelay: `${Math.random() * 5}s`, + animationDuration: `${5 + Math.random() * 5}s`, + transform: `scale(${0.5 + Math.random()})` + })); +}; + +const initialHeartStyles = generateHeartStyles(); // Generate once when module loads + const CelebrationOverlay = () => { - const heartStyles = useMemo(() => { - return Array.from({ length: 30 }).map(() => ({ - left: `${Math.random() * 100}vw`, - animationDelay: `${Math.random() * 5}s`, - animationDuration: `${5 + Math.random() * 5}s`, - transform: `scale(${0.5 + Math.random()})` - })); - }, []); + const heartStyles = useMemo(() => initialHeartStyles, []); // Reference the pre-generated styles const hearts = heartStyles.map((style, i) => (