fix(sqllab): Table options rendering regression (#24142)

This commit is contained in:
JUST.in DO IT 2023-05-22 10:32:45 -07:00 committed by GitHub
parent 2b236cbbd6
commit 6a44e0ddd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -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(
<StyledCheckOutlined iconSize="m" aria-label="check" />
)
}
{...(!shouldRenderChildrenOptions && { options: fullSelectOptions })}
oneLine={oneLine}
tagRender={customTagRender}
{...props}
@ -508,7 +515,8 @@ const Select = forwardRef(
{selectAllLabel()}
</Option>
)}
{renderSelectOptions(fullSelectOptions)}
{shouldRenderChildrenOptions &&
renderSelectOptions(fullSelectOptions)}
</StyledSelect>
</StyledContainer>
);