Skip to content

Commit

Permalink
chore: small refactor for empty search value
Browse files Browse the repository at this point in the history
  • Loading branch information
ingmar-stipriaan committed Oct 9, 2024
1 parent 1afa4db commit b71dc94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/autocompleteInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@
typeof value === 'string' ? value : valueFromProperyNames;

// When you select a property with a null value, use an empty string as fallback to prevent doesNotMatch: null
const isEmptySearchValue =
searchPropertyValue === null || searchPropertyValue === undefined;

const currentSearchValue =
(searchPropertyValue === null || searchPropertyValue === undefined) &&
!searchPropIsNumber
? ''
: searchPropertyValue;
isEmptySearchValue && !searchPropIsNumber ? '' : searchPropertyValue;

// Create the opposite filter of the current value to fetch other records
const remainingRecordsFilter = {
Expand Down

0 comments on commit b71dc94

Please sign in to comment.