-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -223,7 +223,7 @@ export default function Column<OptionType extends DefaultOptionType = DefaultOpt | |
| /> | ||
| )} | ||
| <div className={`${menuItemPrefixCls}-content`}> | ||
| {optionRender ? optionRender(option) : label} | ||
| {optionRender && value !== '__EMPTY__' ? optionRender(option) : label} | ||
|
||
| </div> | ||
| {!isLoading && expandIcon && !isMergedLeaf && ( | ||
| <div className={`${menuItemPrefixCls}-expand-icon`}>{expandIcon}</div> | ||
|
|
||
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 insrc/OptionList/List.tsxbut is not shared. It would be better to define it as an exported constant in a shared location (e.g., alongsideFIX_LABELin this file) and use the constant in both places. This ensures consistency and makes the code easier to understand and refactor in the future.