Repository navigation
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:
|
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [antd](https://ant.design) ([source](https://redirect.github.com/ant-design/ant-design)) | [`6.6.6` → `6.6.7`](https://renovatebot.com/diffs/npm/antd/6.6.6/6.6.7) |  |  | --- ### Release Notes <details> <summary>ant-design/ant-design (antd)</summary> ### [`v6.6.7`](https://redirect.github.com/ant-design/ant-design/releases/tag/6.6.7) [Compare Source](https://redirect.github.com/ant-design/ant-design/compare/6.6.6...6.6.7) - 🐞 Fix antd failing to load in some production builds when the React version export is unavailable. [#​59560](https://redirect.github.com/ant-design/ant-design/pull/59560) [react-component/util#810](https://redirect.github.com/react-component/util/pull/810) [@​github-actions](https://redirect.github.com/apps/github-actions) [@​nrps9909](https://redirect.github.com/nrps9909) - 🐞 Fix Button, Form, Slider, Typography, and Upload triggering delayed state updates after unmounting. [#​59560](https://redirect.github.com/ant-design/ant-design/pull/59560) [react-component/util#806](https://redirect.github.com/react-component/util/pull/806) [@​github-actions](https://redirect.github.com/apps/github-actions) [@​nrps9909](https://redirect.github.com/nrps9909) - 🐞 Fix Select, TreeSelect, Cascader, and Mentions `popupRender` content inheriting Form.Item validation status and feedback icons. [#​59463](https://redirect.github.com/ant-design/ant-design/pull/59463) [@​huytdps13400](https://redirect.github.com/huytdps13400) - 🐞 Fix Popover and Popconfirm preset `color` not applying to the panel background. [#​59549](https://redirect.github.com/ant-design/ant-design/pull/59549) [@​dogledogle](https://redirect.github.com/dogledogle) - Form - 🐞 Fix Form custom `shouldUpdate` comparisons missing updates when nested fields with `preserve={false}` are unmounted. [#​59560](https://redirect.github.com/ant-design/ant-design/pull/59560) [react-component/util#807](https://redirect.github.com/react-component/util/pull/807) [@​github-actions](https://redirect.github.com/apps/github-actions) [@​nrps9909](https://redirect.github.com/nrps9909) - 🐞 Fix Form.Item incorrectly removing a trailing `|` from a string `label` when displaying a colon. [#​59599](https://redirect.github.com/ant-design/ant-design/pull/59599) [@​wfatih](https://redirect.github.com/wfatih) - ⌨️ Fix Form.Item not associating warning-only messages with the control through `aria-describedby`. [#​59443](https://redirect.github.com/ant-design/ant-design/pull/59443) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - Input - 🐞 Fix Input.OTP losing valid characters when pasting text with a filtering `formatter`. [#​59580](https://redirect.github.com/ant-design/ant-design/pull/59580) [@​yunfeizhu](https://redirect.github.com/yunfeizhu) - 🐞 Fix Input.OTP ignoring `rootClassName` on the root element. [#​59439](https://redirect.github.com/ant-design/ant-design/pull/59439) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - 🐞 Fix Input.OTP not rendering a numeric `0` as the `separator`. [#​59518](https://redirect.github.com/ant-design/ant-design/pull/59518) [@​Ye-YiChen](https://redirect.github.com/Ye-YiChen) - Table - 🐞 Fix Table selection menu skipping current-page tree descendants when inverting selection and deselecting disabled rows on other pages when clearing selections. [#​59570](https://redirect.github.com/ant-design/ant-design/pull/59570) [@​yunfeizhu](https://redirect.github.com/yunfeizhu) - 🐞 Fix Table sorted fixed header hover background and the `fixedHeaderSortActiveBg` token not taking effect. [#​59554](https://redirect.github.com/ant-design/ant-design/pull/59554) [@​dogledogle](https://redirect.github.com/dogledogle) - ColorPicker - 🐞 Fix ColorPicker applying RTL styles when ConfigProvider `direction` is `ltr`. [#​59441](https://redirect.github.com/ant-design/ant-design/pull/59441) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - 🐞 Fix ColorPicker number input control button width. [#​59538](https://redirect.github.com/ant-design/ant-design/pull/59538) [@​QDyanbing](https://redirect.github.com/QDyanbing) - 🐞 Fix nested Descriptions being affected by the outer component's borders, spacing, and cell layout. [#​59547](https://redirect.github.com/ant-design/ant-design/pull/59547) [@​xushanpei](https://redirect.github.com/xushanpei) - 🐞 Fix Progress line ignoring string widths in `size`, such as `['50%', 20]`, and always filling the container. [#​59597](https://redirect.github.com/ant-design/ant-design/pull/59597) [@​wfatih](https://redirect.github.com/wfatih) - 🐞 Fix Tooltip failing to limit panel corner radius to 8px for left and right placements when the `borderRadius` token exceeds 8. [#​59568](https://redirect.github.com/ant-design/ant-design/pull/59568) [@​dogledogle](https://redirect.github.com/dogledogle) - 🐞 Fix Popconfirm `onPopupClick` firing twice for a single click inside the popup content. [#​59440](https://redirect.github.com/ant-design/ant-design/pull/59440) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - 🐞 Fix Upload extra content styles when `showUploadList.extra` is `0` or returns `0`. [#​59438](https://redirect.github.com/ant-design/ant-design/pull/59438) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - ♿ Fix Typography duplicate button semantics for the default edit icon. [#​59112](https://redirect.github.com/ant-design/ant-design/pull/59112) [@​nrps9909](https://redirect.github.com/nrps9909) - ⚡️ Improve Transfer source list rendering performance. [#​59524](https://redirect.github.com/ant-design/ant-design/pull/59524) [@​QDyanbing](https://redirect.github.com/QDyanbing) *** - 🐞 修复 antd 在部分生产构建中因 React 版本信息缺失而加载失败的问题。[#​59560](https://redirect.github.com/ant-design/ant-design/pull/59560) [react-component/util#810](https://redirect.github.com/react-component/util/pull/810) [@​github-actions](https://redirect.github.com/apps/github-actions) [@​nrps9909](https://redirect.github.com/nrps9909) - 🐞 修复 Button、Form、Slider、Typography 和 Upload 在卸载后仍触发延迟状态更新的问题。[#​59560](https://redirect.github.com/ant-design/ant-design/pull/59560) [react-component/util#806](https://redirect.github.com/react-component/util/pull/806) [@​github-actions](https://redirect.github.com/apps/github-actions) [@​nrps9909](https://redirect.github.com/nrps9909) - 🐞 修复 Select、TreeSelect、Cascader 和 Mentions 的 `popupRender` 内容继承 Form.Item 校验状态和反馈图标的问题。[#​59463](https://redirect.github.com/ant-design/ant-design/pull/59463) [@​huytdps13400](https://redirect.github.com/huytdps13400) - 🐞 修复 Popover 和 Popconfirm 设置预设 `color` 后面板背景色不生效的问题。[#​59549](https://redirect.github.com/ant-design/ant-design/pull/59549) [@​dogledogle](https://redirect.github.com/dogledogle) - Form - 🐞 修复 Form 嵌套字段设置 `preserve={false}` 后卸载时,自定义 `shouldUpdate` 判断可能无法更新关联内容的问题。[#​59560](https://redirect.github.com/ant-design/ant-design/pull/59560) [react-component/util#807](https://redirect.github.com/react-component/util/pull/807) [@​github-actions](https://redirect.github.com/apps/github-actions) [@​nrps9909](https://redirect.github.com/nrps9909) - 🐞 修复 Form.Item 显示冒号时误删字符串 `label` 末尾 `|` 的问题。[#​59599](https://redirect.github.com/ant-design/ant-design/pull/59599) [@​wfatih](https://redirect.github.com/wfatih) - ⌨️ 修复 Form.Item 仅有警告信息时未通过 `aria-describedby` 关联到控件的问题。[#​59443](https://redirect.github.com/ant-design/ant-design/pull/59443) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - Input - 🐞 修复 Input.OTP 使用过滤型 `formatter` 时粘贴文本会丢失有效字符的问题。[#​59580](https://redirect.github.com/ant-design/ant-design/pull/59580) [@​yunfeizhu](https://redirect.github.com/yunfeizhu) - 🐞 修复 Input.OTP 根节点未应用 `rootClassName` 的问题。[#​59439](https://redirect.github.com/ant-design/ant-design/pull/59439) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - 🐞 修复 Input.OTP 无法渲染数值 `0` 作为 `separator` 的问题。[#​59518](https://redirect.github.com/ant-design/ant-design/pull/59518) [@​Ye-YiChen](https://redirect.github.com/Ye-YiChen) - Table - 🐞 修复 Table 选择菜单反选时遗漏当前页树形子节点,以及清空选择时取消其他页禁用行选中状态的问题。[#​59570](https://redirect.github.com/ant-design/ant-design/pull/59570) [@​yunfeizhu](https://redirect.github.com/yunfeizhu) - 🐞 修复 Table 固定排序表头悬停背景异常及 `fixedHeaderSortActiveBg` token 不生效的问题。[#​59554](https://redirect.github.com/ant-design/ant-design/pull/59554) [@​dogledogle](https://redirect.github.com/dogledogle) - ColorPicker - 🐞 修复 ConfigProvider 的 `direction` 为 `ltr` 时 ColorPicker 仍应用 RTL 样式的问题。[#​59441](https://redirect.github.com/ant-design/ant-design/pull/59441) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - 🐞 修复 ColorPicker 数值输入框操作按钮宽度异常的问题。[#​59538](https://redirect.github.com/ant-design/ant-design/pull/59538) [@​QDyanbing](https://redirect.github.com/QDyanbing) - 🐞 修复嵌套 Descriptions 受到外层组件边框、间距和单元格布局影响的问题。[#​59547](https://redirect.github.com/ant-design/ant-design/pull/59547) [@​xushanpei](https://redirect.github.com/xushanpei) - 🐞 修复 Progress 线形进度条 `size` 传入字符串宽度(如 `['50%', 20]`)时不生效、始终撑满容器的问题。[#​59597](https://redirect.github.com/ant-design/ant-design/pull/59597) [@​wfatih](https://redirect.github.com/wfatih) - 🐞 修复 Tooltip 的 `borderRadius` token 大于 8 时,左右侧弹层圆角未限制为 8px 的问题。[#​59568](https://redirect.github.com/ant-design/ant-design/pull/59568) [@​dogledogle](https://redirect.github.com/dogledogle) - 🐞 修复点击 Popconfirm 弹层内容时 `onPopupClick` 被触发两次的问题。[#​59440](https://redirect.github.com/ant-design/ant-design/pull/59440) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - 🐞 修复 Upload 的 `showUploadList.extra` 为 `0` 或返回 `0` 时额外内容样式未生效的问题。[#​59438](https://redirect.github.com/ant-design/ant-design/pull/59438) [@​Chaoqi31](https://redirect.github.com/Chaoqi31) - ♿ 修复 Typography 默认编辑图标暴露重复按钮语义的问题。[#​59112](https://redirect.github.com/ant-design/ant-design/pull/59112) [@​nrps9909](https://redirect.github.com/nrps9909) - ⚡️ 优化 Transfer 左侧列表的渲染性能。[#​59524](https://redirect.github.com/ant-design/ant-design/pull/59524) [@​QDyanbing](https://redirect.github.com/QDyanbing) </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/Helsinki) - Branch creation - "on monday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNDMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE0My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: thaw-release-bot[bot] <277444778+thaw-release-bot[bot]@users.noreply.github.com>
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 修复
测试