diff --git a/src/app/page.tsx b/src/app/page.tsx index aedfd80..b0c8266 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -9,11 +9,12 @@ import TestimonialCardThirteen from '@/components/sections/testimonial/Testimoni import ContactCTA from '@/components/sections/contact/ContactCTA'; import FooterCard from '@/components/sections/footer/FooterCard'; import { Heart, TrendingUp, Calendar, Flame, Star, Award, Zap, MessageSquare, Twitter, Instagram, MessageCircle } from 'lucide-react'; -import { useEffect, useState, useCallback } from 'react'; +import { useEffect, useState, useCallback, useRef } from 'react'; export default function LandingPage() { const [isDark, setIsDark] = useState(false); const [mounted, setMounted] = useState(false); + const themeAppliedRef = useRef(false); const applyTheme = useCallback((theme: string) => { const isDarkTheme = theme === 'dark'; @@ -49,11 +50,12 @@ export default function LandingPage() { }, []); useEffect(() => { - if (mounted) return; + if (themeAppliedRef.current) return; + themeAppliedRef.current = true; const theme = localStorage.getItem('theme') || 'light'; applyTheme(theme); setMounted(true); - }, []); + }, [applyTheme]); const toggleTheme = () => { const newTheme = isDark ? 'light' : 'dark';