perf: throttle scroll event listener in Navbar

Implemented `requestAnimationFrame` throttling for the scroll event listener in `Navbar` to reduce the frequency of state updates and logic execution.

- Wrapped scroll handler in `requestAnimationFrame`.
- Added performance test `src/components/layout/Navbar.test.tsx` verifying logic runs once per frame instead of per event.
- Verified functional correctness of scroll state updates.
- Fixed `useTypingEffect` test environment.
This commit is contained in:
google-labs-jules[bot]
2026-01-22 08:24:10 +00:00
parent dfd5461485
commit 8592775485
3 changed files with 100 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
// @vitest-environment jsdom
import { renderHook, act } from '@testing-library/react';
import { useTypingEffect } from './useTypingEffect';
import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';