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:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user