From c152b778cf34e0dbb3556d0e57fed4a4082230f7 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Mon, 19 Aug 2024 22:00:09 +0530 Subject: [PATCH 1/2] Fixes an edge case where a second query is made with empty string leading to field getting disabled and locked out --- src/Components/Common/UserAutocompleteFormField.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Components/Common/UserAutocompleteFormField.tsx b/src/Components/Common/UserAutocompleteFormField.tsx index a42fea1890c..859007b172d 100644 --- a/src/Components/Common/UserAutocompleteFormField.tsx +++ b/src/Components/Common/UserAutocompleteFormField.tsx @@ -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 ( From 7950f29e56733483fe2a2223d638fe783a097c66 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Mon, 19 Aug 2024 22:01:52 +0530 Subject: [PATCH 2/2] remove console log --- src/Components/Common/UserAutocompleteFormField.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Components/Common/UserAutocompleteFormField.tsx b/src/Components/Common/UserAutocompleteFormField.tsx index 859007b172d..dd7c4c4301e 100644 --- a/src/Components/Common/UserAutocompleteFormField.tsx +++ b/src/Components/Common/UserAutocompleteFormField.tsx @@ -59,7 +59,6 @@ export default function UserAutocomplete(props: UserSearchProps) { } if (data.results.length === 0) { - console.log({ query }); setDisabled(true); field.handleChange(undefined as unknown as UserBareMinimum); }