diff --git a/superset-frontend/src/components/Select/Select.tsx b/superset-frontend/src/components/Select/Select.tsx index c2e47e3cc49c4..c8961de9285c2 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; @@ -492,6 +498,7 @@ const Select = forwardRef( ) } + {...(!shouldRenderChildrenOptions && { options: fullSelectOptions })} oneLine={oneLine} tagRender={customTagRender} {...props} @@ -507,7 +514,8 @@ const Select = forwardRef( {selectAllLabel()} )} - {renderSelectOptions(fullSelectOptions)} + {shouldRenderChildrenOptions && + renderSelectOptions(fullSelectOptions)} );