Skip to content

fix(common): select options display bug #2305

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

Merged
Merged
Changes from all commits
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
10 changes: 5 additions & 5 deletions shell/app/common/components/render-form-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,8 @@ interface SelectCompProps {
itemProps: Obj;
}

const SelectComp = ({ value, onChange, options: _options, size, itemProps }: SelectCompProps) => {
const options = typeof _options === 'function' ? _options() : _options;

const fixOptions = options.filter((item: IOption) => item.fix);
const SelectComp = ({ value, onChange, options, size, itemProps }: SelectCompProps) => {
const fixOptions = options.filter?.((item: IOption) => item.fix) || [];

return (
<Select
Expand Down Expand Up @@ -415,7 +413,9 @@ const SelectComp = ({ value, onChange, options: _options, size, itemProps }: Sel
</div>
)}
>
{options.filter((item: IOption) => !item.fix).map((item: IOption) => renderSelectOption(item))}
{typeof options === 'function'
? options()
: options.filter((item: IOption) => !item.fix).map((item: IOption) => renderSelectOption(item))}
</Select>
);
};
Expand Down