Skip to content

Commit 432e8c0

Browse files
committed
fix: closing tooltip popup on map closes property details
1 parent e2a0565 commit 432e8c0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/PropertyMap.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ const PropertyMap: FC<PropertyMapProps> = ({
340340
useEffect(() => {
341341
if (!map) return;
342342
if (!selectedProperty) {
343-
// setPopupInfo(null);
343+
setPopupInfo(null);
344344
if (window.innerWidth < 640 && prevCoordinate) {
345345
map.setCenter(prevCoordinate as LngLatLike);
346346
setPrevCoordinate();
@@ -423,6 +423,11 @@ const PropertyMap: FC<PropertyMapProps> = ({
423423
e.target.getCanvas().style.cursor = cursorType;
424424
};
425425

426+
const handlePopupClose = () => {
427+
setSelectedProperty(null);
428+
setPopupInfo(null);
429+
};
430+
426431
// map load
427432
return (
428433
<div className="customized-map relative max-sm:min-h-[calc(100svh-100px)] max-sm:max-h-[calc(100svh-100px) h-full overflow-auto w-full">
@@ -515,7 +520,7 @@ const PropertyMap: FC<PropertyMapProps> = ({
515520
longitude={popupInfo.longitude}
516521
latitude={popupInfo.latitude}
517522
closeOnClick={false}
518-
onClose={() => setPopupInfo(null)}
523+
onClose={handlePopupClose}
519524
>
520525
<div className="flex flex-row items-center nowrap space-x-1">
521526
<span>{toTitleCase(popupInfo.feature.address)}</span>

0 commit comments

Comments
 (0)