Skip to content

Commit

Permalink
Fixes an edge case where a second query is made with empty string lea…
Browse files Browse the repository at this point in the history
…ding to field getting disabled and locked out
  • Loading branch information
rithviknishad committed Aug 19, 2024
1 parent e7608d5 commit c152b77
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Components/Common/UserAutocompleteFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ export default function UserAutocomplete(props: UserSearchProps) {
}

if (data.results.length === 0) {
console.log({ query });
setDisabled(true);
field.handleChange(undefined as unknown as UserBareMinimum);
}
}, [loading, query, field.required, data?.results, props.noResultsError]);
}, [loading, field.required, data?.results, props.noResultsError]);

return (
<FormField field={field}>
Expand Down

0 comments on commit c152b77

Please sign in to comment.