Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sqllab): Table options rendering regression #24142

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 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 shouldUseChildrenOptions = useMemo(
() => !selectAllEnabled || hasCustomLabels(options),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
() => !selectAllEnabled || hasCustomLabels(options),
() => 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" />
)
}
{...(!shouldUseChildrenOptions && { options: fullSelectOptions })}
oneLine={oneLine}
tagRender={customTagRender}
{...props}
Expand All @@ -508,7 +515,7 @@ const Select = forwardRef(
{selectAllLabel()}
</Option>
)}
{renderSelectOptions(fullSelectOptions)}
{shouldUseChildrenOptions && renderSelectOptions(fullSelectOptions)}
</StyledSelect>
</StyledContainer>
);
Expand Down