-
-
Notifications
You must be signed in to change notification settings - Fork 145
fix: optionRender usage for empty search results #636
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
base: master
Are you sure you want to change the base?
Conversation
|
@QdabuliuQ is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @QdabuliuQ, 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. 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
|
WalkthroughPR修改了Column组件中optionRender的条件渲染逻辑,使其仅在optionRender存在且选项值不为'EMPTY'时才应用自定义渲染,否则直接显示标签。并新增三个测试用例验证notFoundContent与optionRender的优先级。 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a bug where notFoundContent was not displayed when optionRender was also used and search results were empty. The fix in src/OptionList/Column.tsx is correct and prevents optionRender from being called on the special empty option. The new tests in tests/search.spec.tsx are comprehensive, covering the fix, a positive case, and an edge case. I have one suggestion regarding the use of a magic string to improve code maintainability.
| )} | ||
| <div className={`${menuItemPrefixCls}-content`}> | ||
| {optionRender ? optionRender(option) : label} | ||
| {optionRender && value !== '__EMPTY__' ? optionRender(option) : label} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this correctly fixes the bug, using the magic string __EMPTY__ makes the code less maintainable and more brittle. This string is also used in src/OptionList/List.tsx but is not shared. It would be better to define it as an exported constant in a shared location (e.g., alongside FIX_LABEL in this file) and use the constant in both places. This ensures consistency and makes the code easier to understand and refactor in the future.
🤔 This is a ...
🔗 Related Issues
issue: 56724
💡 Background and Solution
When both the optionRender and notFoundContent properties are set on the Cascader component, the search results are empty and notFoundContent does not take effect.
📝 Change Log
Summary by CodeRabbit
发布说明
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.