From 6a44e0ddd4a48f384bd01143dc3e11ddf2ebce24 Mon Sep 17 00:00:00 2001 From: "JUST.in DO IT" Date: Mon, 22 May 2023 10:32:45 -0700 Subject: [PATCH] fix(sqllab): Table options rendering regression (#24142) --- superset-frontend/src/components/Select/Select.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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)} );