diff --git a/superset-frontend/src/components/Select/Select.tsx b/superset-frontend/src/components/Select/Select.tsx index ed027731de952..1cc222f00277a 100644 --- a/superset-frontend/src/components/Select/Select.tsx +++ b/superset-frontend/src/components/Select/Select.tsx @@ -47,6 +47,7 @@ import { selectAllOption, mapValues, mapOptions, + hasCustomLabels, } from './utils'; import { SelectOptionsType, SelectProps } from './types'; import { @@ -440,6 +441,11 @@ const Select = forwardRef( onChange?.(newValues, newOptions); }; + const shouldRenderChildrenOptions = useMemo( + () => selectAllEnabled || hasCustomLabels(options), + [selectAllEnabled, options], + ); + const customMaxTagPlaceholder = () => { const num_selected = ensureIsArray(selectValue).length; const num_shown = maxTagCount as number; @@ -493,6 +499,7 @@ const Select = forwardRef( ) } + {...(!shouldRenderChildrenOptions && { options: fullSelectOptions })} oneLine={oneLine} tagRender={customTagRender} {...props} @@ -508,7 +515,8 @@ const Select = forwardRef( {selectAllLabel()} )} - {renderSelectOptions(fullSelectOptions)} + {shouldRenderChildrenOptions && + renderSelectOptions(fullSelectOptions)} );