-
-
Notifications
You must be signed in to change notification settings - Fork 478
fix: improve useDelayReset logic and add focus test for Select #1160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough本次变更主要涉及 Changes
Sequence Diagram(s)sequenceDiagram
participant ReactComponent as 组件
participant useDelayReset
participant setState
participant callback
ReactComponent->>useDelayReset: 调用 delaySetBool(true, cb)
useDelayReset->>setState: 立即设置为 true
alt 有回调
useDelayReset->>callback: 立即执行
end
ReactComponent->>useDelayReset: 调用 delaySetBool(false, cb)
useDelayReset->>setTimeout: 延迟后设置为 false
alt 有回调
useDelayReset->>callback: 延迟后执行
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes无发现超出关联 issue 目标的代码变更。 Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1160 +/- ##
=======================================
Coverage 98.11% 98.11%
=======================================
Files 39 39
Lines 1484 1489 +5
Branches 422 444 +22
=======================================
+ Hits 1456 1461 +5
Misses 28 28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🤔 This is a ...
🔗 Related Issues
fix: ant-design/ant-design#54546
💡 Background and Solution
Select component doesn't show focus style when calling focus() after enabling StrictMode
In StrictMode, useEffect executes multiple times. The delaySetBool method distinguishes the value - if it's false, it enters the delay branch.
📝 Change Log
Summary by CodeRabbit
修复问题
测试