Skip to content

Commit

Permalink
🐛 null check for value
Browse files Browse the repository at this point in the history
  • Loading branch information
harshzalavadiya committed Nov 29, 2019
1 parent 20c8879 commit 6f47d9a
Showing 1 changed file with 36 additions and 33 deletions.
69 changes: 36 additions & 33 deletions src/multi-select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const MultiSelect = ({
hasSelectAll = true,
shouldToggleOnHover = false,
options,
value = [],
value,
valueRenderer,
overrideStrings,
onChange,
Expand All @@ -30,37 +30,40 @@ const MultiSelect = ({
filterOptions,
labelledBy,
theme
}: ISelectProps) => (
<DropdownThemeProvider theme={theme}>
<MultiSelectBox className="multi-select">
<Dropdown
isLoading={isLoading}
contentComponent={SelectPanel}
shouldToggleOnHover={shouldToggleOnHover}
contentProps={{
ItemRenderer,
options,
value,
hasSelectAll,
selectAllLabel,
onChange,
disabled,
disableSearch,
filterOptions,
overrideStrings
}}
disabled={disabled}
labelledBy={labelledBy}
>
<DropdownHeader
value={value}
options={options}
valueRenderer={valueRenderer}
overrideStrings={overrideStrings}
/>
</Dropdown>
</MultiSelectBox>
</DropdownThemeProvider>
);
}: ISelectProps) => {
const nvalue = value || [];
return (
<DropdownThemeProvider theme={theme}>
<MultiSelectBox className="multi-select">
<Dropdown
isLoading={isLoading}
contentComponent={SelectPanel}
shouldToggleOnHover={shouldToggleOnHover}
contentProps={{
ItemRenderer,
options,
value: nvalue,
hasSelectAll,
selectAllLabel,
onChange,
disabled,
disableSearch,
filterOptions,
overrideStrings
}}
disabled={disabled}
labelledBy={labelledBy}
>
<DropdownHeader
value={nvalue}
options={options}
valueRenderer={valueRenderer}
overrideStrings={overrideStrings}
/>
</Dropdown>
</MultiSelectBox>
</DropdownThemeProvider>
);
};

export default MultiSelect;

0 comments on commit 6f47d9a

Please sign in to comment.