Skip to content

Commit

Permalink
chore: testing selection
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj committed Dec 2, 2024
1 parent fcb0bfc commit ce15747
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions frontend/src/components/AutocompleteClientLocation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ const AutocompleteClientLocation: React.ForwardRefExoticComponent<AutocompleteCo
const handleClientChange = (autocompleteEvent: AutocompleteComboboxProps) => {

const selectedItem = autocompleteEvent.selectedItem;
console.log(`Client selected here`, selectedItem);
if (selectedItem) {
setIsActive(true);
setClient(selectedItem);
fetchOptions(selectedItem.id, "locations");
}else{
clearClient();
}
Expand All @@ -101,6 +100,15 @@ const AutocompleteClientLocation: React.ForwardRefExoticComponent<AutocompleteCo
setValue(location?.id ?? null);
}, [location]);

useEffect(() => {
console.log(`Client changed`, client);
setIsActive(client ? true : false);
if(client)
fetchOptions(client.id, "locations");
else
updateOptions("locations", []);
}, [client]);

return (
<div className="d-flex w-100 gap-1 mt-2">
<ComboBox
Expand Down

0 comments on commit ce15747

Please sign in to comment.