From 018921b6ea593c04605a5056ebf5fb234715e511 Mon Sep 17 00:00:00 2001 From: Damjan Savic Date: Sun, 25 Jan 2026 06:31:07 +0100 Subject: [PATCH] auto-claude: subtask-3-1 - Apply throttle to Header scroll event listener --- src/components/layout/Header.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index 8af889e..599b18b 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -18,6 +18,7 @@ import { usePathname } from 'next/navigation'; import { NavLink } from './NavLink'; import LanguageSwitcher from './LanguageSwitcher'; import { ContactInfo } from './ContactInfo'; +import { throttle } from '@/utils/throttle'; const Header = () => { const t = useTranslations('navigation'); @@ -33,9 +34,9 @@ const Header = () => { // Scroll handler useEffect(() => { - const handleScroll = () => { + const handleScroll = throttle(() => { setScrolled(window.scrollY > 0); - }; + }, 100); window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []);