Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
fix(sqllab): Table options rendering regression (apache#24142)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6a44e0d)
  • Loading branch information
justinpark authored and john-bodley committed Jun 21, 2023
1 parent 3c1fba0 commit 8b88480
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 @@ -492,6 +498,7 @@ const Select = forwardRef(
<StyledCheckOutlined iconSize="m" aria-label="check" />
)
}
{...(!shouldRenderChildrenOptions && { options: fullSelectOptions })}
oneLine={oneLine}
tagRender={customTagRender}
{...props}
Expand All @@ -507,7 +514,8 @@ const Select = forwardRef(
{selectAllLabel()}
</Option>
)}
{renderSelectOptions(fullSelectOptions)}
{shouldRenderChildrenOptions &&
renderSelectOptions(fullSelectOptions)}
</StyledSelect>
</StyledContainer>
);
Expand Down

0 comments on commit 8b88480

Please sign in to comment.