Conversation
Return both ssrSafeOpen and mergedOpen to prevent incorrect clearing of search text when mergedOpen differs from rawOpen. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @zombieJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a bug in the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1201 +/- ##
=======================================
Coverage 99.43% 99.43%
=======================================
Files 31 31
Lines 1230 1230
Branches 439 441 +2
=======================================
Hits 1223 1223
Misses 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Walkthrough将 useOpen 钩子返回值扩展为四元组以暴露新的 rawOpen,并在 BaseSelect 中将清理内部搜索的 effect 依赖从 mergedOpen 改为 rawOpen;新增测试覆盖 notFoundContent 为 null 时的搜索行为。 Changes
Sequence Diagram(s)(不需要生成序列图) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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 |
There was a problem hiding this comment.
Code Review
This pull request effectively resolves an issue where the Select component's search input was being cleared when notFoundContent was null and no options matched the search. The solution involves introducing a rawOpen state from the useOpen hook to distinguish between a user-initiated close and an automatic one due to empty content. This prevents the search input from being cleared incorrectly, improving the user experience. The changes are well-implemented, and the addition of a new test case ensures the fix is properly verified. I have one minor suggestion to improve code clarity.
| React.useEffect(() => { | ||
| if (!mergedOpen && !multiple && mode !== 'combobox') { | ||
| if (!rawOpen && !multiple && mode !== 'combobox') { | ||
| onInternalSearch('', false, false); | ||
| } | ||
| }, [mergedOpen]); | ||
| }, [rawOpen]); |
There was a problem hiding this comment.
Using rawOpen here is the core of the fix, and it's a good one. To improve maintainability, it would be beneficial to add a comment explaining why rawOpen is used instead of mergedOpen. This would help future developers understand the distinction and the reason for this logic, especially since mergedOpen is used in most other places.
For example:
// Clean up search value when the dropdown is closed.
// We use `rawOpen` here to avoid clearing the search input when the dropdown is
// programmatically closed due to `notFoundContent={null}` and no matching options.
// This allows the user to continue typing their search query.Clarify why rawOpen is used instead of mergedOpen to prevent premature clearing of search input. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fix ant-design/ant-design#55968
fix ant-design/ant-design#56735
close #1199
Summary by CodeRabbit
发布说明
改进
测试