diff --git a/src/components/CustomStaticLocationAutoCompleteV2.jsx b/src/components/CustomStaticLocationAutoCompleteV2.jsx index 0712fdd..055e0a4 100644 --- a/src/components/CustomStaticLocationAutoCompleteV2.jsx +++ b/src/components/CustomStaticLocationAutoCompleteV2.jsx @@ -5,37 +5,51 @@ import { useController } from "react-hook-form"; import LocationIcon from "./frontend/icons/LocationIcon"; import { GlobalContext } from "@/globalContext"; -export default function CustomStaticLocationAutoCompleteV2({ type, control, name, setValue, onClear, className, containerClassName, hideIcons, suggestionType, ...restProps }) { - const { dispatch: globalDispatch, state: globalState } = useContext(GlobalContext); +export default function CustomStaticLocationAutoCompleteV2({ + type, + control, + name, + setValue, + onClear, + className, + containerClassName, + hideIcons, + suggestionType, + ...restProps +}) { + const { dispatch: globalDispatch, state: globalState } = + useContext(GlobalContext); const [location, setLocation] = useState(globalState.location); - - const { placePredictions, getPlacePredictions, isPlacePredictionsLoading } = usePlacesService({ - apiKey: import.meta.env.VITE_GOOGLE_API_KEY, - options: { types: suggestionType ?? ["(region)"] }, - debounce: 200, - }); + const { placePredictions, getPlacePredictions, isPlacePredictionsLoading } = + usePlacesService({ + apiKey: import.meta.env.VITE_GOOGLE_API_KEY, + options: { types: suggestionType ?? ["(region)"] }, + debounce: 200, + }); return ( {!hideIcons && } { - setLocation(evt.target.value) + setLocation(evt.target.value); getPlacePredictions({ input: evt.target.value }); }} /> {!hideIcons && globalState.location && (