This commit is contained in:
Ben Mitchinson 2025-10-09 22:51:54 -07:00
parent 79b31ac634
commit df9dcca62e
1 changed files with 24 additions and 17 deletions

View File

@ -35,23 +35,30 @@ const LocationSelector = (props: Props) => {
const [popoverOpen, setPopoverOpen] = useState<boolean>(false);
useEffect(() => {
if (props.location) {
setState((state) => ({
...state,
placeholder: props.location.placeholder || "",
position: new LatLng(props.location.latitude, props.location.longitude),
latInput: String(props.location.latitude),
lngInput: String(props.location.longitude),
}));
} else {
setState((state) => ({
...state,
placeholder: "",
position: undefined,
latInput: "",
lngInput: "",
}));
}
setState((state) => ({
...state,
placeholder: props.location?.placeholder || "",
position: new LatLng(props.location?.latitude || 0, props.location?.longitude || 0),
latInput: String(props.location?.latitude) || "",
lngInput: String(props.location?.longitude) || "",
}));
// if (props.location) {
// setState((state) => ({
// ...state,
// placeholder: props.location.placeholder || "",
// position: new LatLng(props.location.latitude, props.location.longitude),
// latInput: String(props.location.latitude),
// lngInput: String(props.location.longitude),
// }));
// } else {
// setState((state) => ({
// ...state,
// placeholder: "",
// position: undefined,
// latInput: "",
// lngInput: "",
// }));
// }
}, [props.location]);
useEffect(() => {