Skip to content

Commit

Permalink
Merge pull request meshery#9860 from sudhanshutech/fix/null
Browse files Browse the repository at this point in the history
[bug] fix null check for environment
  • Loading branch information
sudhanshutech authored Jan 8, 2024
2 parents 8fc733b + 51694f6 commit b988563
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ui/components/multi-select-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const MultiSelectWrapper = (props) => {
const allOption = { value: '*', label: selectAllLabel.current };

const filterOptions = (options, input) =>
options?.filter(({ label }) => label.toLowerCase().includes(input.toLowerCase()));
options?.filter(({ label }) => label?.toLowerCase().includes(input.toLowerCase()));

const comparator = (v1, v2) => {
if (v1.value === allOption.value) {
Expand All @@ -22,7 +22,7 @@ const MultiSelectWrapper = (props) => {
return -1;
}

return v1.label.localeCompare(v2.label);
return v1.label?.localeCompare(v2.label);
};

let filteredOptions = filterOptions(props.options, selectInput).sort(comparator);
Expand Down Expand Up @@ -101,7 +101,7 @@ const MultiSelectWrapper = (props) => {
};

const customFilterOption = ({ value, label }, input) =>
(value !== '*' && label.toLowerCase().includes(input.toLowerCase())) ||
(value !== '*' && label?.toLowerCase().includes(input.toLowerCase())) ||
(value === '*' && filteredOptions?.length > 0);

const onInputChange = (inputValue, event) => {
Expand All @@ -127,7 +127,7 @@ const MultiSelectWrapper = (props) => {
...(props.value ?? []),
...props.options.filter(
({ label }) =>
label.toLowerCase().includes(selectInput?.toLowerCase()) &&
label?.toLowerCase().includes(selectInput?.toLowerCase()) &&
(props.value ?? []).filter((opt) => opt.label === label).length === 0,
),
].sort(comparator),
Expand Down

0 comments on commit b988563

Please sign in to comment.