Skip to content

Commit

Permalink
equality warning fix
Browse files Browse the repository at this point in the history
  • Loading branch information
m4manjesh committed Nov 15, 2023
1 parent 7061a2a commit 2e33613
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/Autocomplete/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,18 @@ export default function Autocomplete<
disabled={disabled}
size={size}
isOptionEqualToValue={(option, value) => {
// if the option is a key value pair, compare option.value to value
if (isKeyValueOption(option)) {
if (option.value === value) {
return true;
}
// if the option is a key value pair, compare option.value to value.value
if (
isKeyValueOption(option) &&
(isKeyValueOption(value)
? option.value === value.value
: option.value === value)
) {
return true;
} else {
// if the option is not a key value then compare option to value
if (option === value) {
return true;
}
if (option === value) return true;
}

// if the option is not a match, return false
return false;
}}
/>
Expand Down

0 comments on commit 2e33613

Please sign in to comment.