Skip to content

Commit

Permalink
[@mantine/core] Select: Fix incorrect behavior when both `searchValue…
Browse files Browse the repository at this point in the history
…` and `value` are controlled (#4998)

Co-authored-by: Jaden Gregory <[email protected]>
  • Loading branch information
DoubleJ-G and Jaden Gregory authored Oct 12, 2023
1 parent b326812 commit 07d85c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mantine-core/src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ export const Select = factory<SelectFactory>((_props, ref) => {
setSearch('');
}

if (typeof value === 'string' && optionsLockup[value]) {
setSearch(optionsLockup[value].label);
if (typeof value === 'string' && selectedOption) {
setSearch(selectedOption.label);
}
}, [value, optionsLockup]);
}, [value, selectedOption]);

const clearButton = clearable && !!_value && !disabled && !readOnly && (
<Combobox.ClearButton
Expand Down

0 comments on commit 07d85c5

Please sign in to comment.