Skip to content

Commit

Permalink
fix(sqllab): Table options rendering regression (#24142)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark authored May 22, 2023
1 parent 2b236cb commit 6a44e0d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion superset-frontend/src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
selectAllOption,
mapValues,
mapOptions,
hasCustomLabels,
} from './utils';
import { SelectOptionsType, SelectProps } from './types';
import {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -493,6 +499,7 @@ const Select = forwardRef(
<StyledCheckOutlined iconSize="m" aria-label="check" />
)
}
{...(!shouldRenderChildrenOptions && { options: fullSelectOptions })}
oneLine={oneLine}
tagRender={customTagRender}
{...props}
Expand All @@ -508,7 +515,8 @@ const Select = forwardRef(
{selectAllLabel()}
</Option>
)}
{renderSelectOptions(fullSelectOptions)}
{shouldRenderChildrenOptions &&
renderSelectOptions(fullSelectOptions)}
</StyledSelect>
</StyledContainer>
);
Expand Down

0 comments on commit 6a44e0d

Please sign in to comment.