Conversation
|
|
✅ Deploy Preview for rspress-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR optimizes the useWindowSize hook by implementing a 150ms debounce on window resize events to reduce the frequency of state updates and improve performance during window resizing.
Key changes:
- Added inline debounce implementation with
RESIZE_DEBOUNCE_MSconstant - Initial window size is now set immediately without debounce
- Added cleanup for pending timeouts on component unmount
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rsdoctor Bundle Diff Analysis📁 webPath:
📦 Download Diff Report: web Bundle Diff Generated by Rsdoctor GitHub Action |
…rage Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Summary
Reduces resize event handler execution frequency in
useWindowSizehook using a 150ms debounce. Prevents excessive state updates during window resize without adding external dependencies.Before: Every resize event immediately triggers state update
After: State updates debounced to 150ms intervals
Implementation:
RESIZE_DEBOUNCE_MSconstant (150ms)Related Issue
优化 useWindowSize 的性能,可以通过减少调用频率,使用防抖策略等
Checklist
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.