Skip to content

Commit

Permalink
[@mantine/core] Fix MultiSelect nothingFoundMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaden Gregory committed Oct 9, 2023
1 parent 9aef3f5 commit e19e1d5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/mantine-core/src/components/MultiSelect/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ export const MultiSelect = factory<MultiSelectFactory>((_props, ref) => {
/>
);

const filteredData = filterPickedValues({ data: parsedData, value: _value });
const optionsDropdownData = hidePickedOptions ? filteredData : parsedData;

return (
<>
<Combobox
Expand Down Expand Up @@ -353,17 +356,15 @@ export const MultiSelect = factory<MultiSelectFactory>((_props, ref) => {
</Combobox.DropdownTarget>

<OptionsDropdown
data={
hidePickedOptions ? filterPickedValues({ data: parsedData, value: _value }) : parsedData
}
data={optionsDropdownData}
hidden={readOnly || disabled}
filter={filter}
search={_searchValue}
limit={limit}
hiddenWhenEmpty={
hidePickedOptions ||
!searchable ||
!nothingFoundMessage ||
(!searchable && _searchValue.trim().length !== 0)
(hidePickedOptions && filteredData.length === 0 && _searchValue.trim().length === 0)
}
withScrollArea={withScrollArea}
maxDropdownHeight={maxDropdownHeight}
Expand Down

0 comments on commit e19e1d5

Please sign in to comment.