Skip to content

Commit

Permalink
fix: optimizes relationship input search querying
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRibbens committed Feb 23, 2022
1 parent cbf43fa commit 7e69fcb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,17 @@ const Relationship: React.FC<Props> = (props) => {
return undefined;
}, [hasMany, hasMultipleRelations, value, options]);

const handleInputChange = useDebouncedCallback((searchArg: string, valueArg: unknown) => {
const updateSearch = useDebouncedCallback((searchArg: string, valueArg: unknown) => {
getResults({ search: searchArg, value: valueArg, sort: true });
setSearch(searchArg);
}, [getResults]);

const handleInputChange = (searchArg: string, valueArg: unknown) => {
if (search !== searchArg) {
updateSearch(searchArg, valueArg);
}
};

// ///////////////////////////
// Fetch value options when initialValue changes
// ///////////////////////////
Expand Down

0 comments on commit 7e69fcb

Please sign in to comment.