fix(useDelayState): cancel pending updates on unmount - #806
Conversation
|
@nrps9909 is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. Walkthrough
Changes延迟状态清理
Estimated code review effort: 2 (简单) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change cancels pending delayed updates when the hook unmounts, with regression tests covering both delay modes. No actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 小兔挥爪,帧与定时器停止奔跑 Comment |
|
CI failed. |
|
On "CI failed" — the two failures in One note on the change: the cleanup is We hit #805 independently on antd 6; numbers posted there. The fix matches the diagnosis. |
cb17e58 to
c3e4e08
Compare
|
Rebased onto current
The cleanup retains |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #806 +/- ##
==========================================
+ Coverage 86.77% 86.78% +0.01%
==========================================
Files 41 41
Lines 1096 1097 +1
Branches 397 382 -15
==========================================
+ Hits 951 952 +1
Misses 143 143
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
useDelayStateunmountscancelPendingpath for cleanupProblem
useDelayStatecancels pending work before scheduling a replacement, but it did not cancel that work on unmount. In React 19/Vitest environments this can leave the callback alive beyond jsdom teardown and surface errors such aswindow is not defined.Fixes #805.
Verification — September 17, 2026
Rebased onto current
master(c241125); signed/GitHub-Verified head:c3e4e08f2fb6b69da4e1caa84c65c22765d97f8f.pickAttrsand React-17 fallback test failures.action_required. A maintainer must approve the fork workflow before it can run.The cleanup retains
[cancelPending]:useEventreturns a stable callback, so this preserves unmount cleanup and satisfies the hook dependency contract.AI assistance disclosure
Codex assisted with implementation, conflict resolution, regression tests, and validation.
Summary by CodeRabbit
Bug 修复
测试