Skip to content

Commit debb670

Browse files
committed
same marker ignore click event again
1 parent 6406855 commit debb670

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/pages/ExplorePage/places/PlacesMarkers.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ const PlacesMarkers = function Markers() {
1212

1313
const handleClick = useCallback(
1414
(placeId?: string, location?: [number, number]) => {
15+
if (selection && placeId === selection.placeId) return;
1516
if (placeId) setSelection({ placeId, location, source: "marker" });
1617
},
17-
[setSelection],
18+
[selection, setSelection],
1819
);
1920

2021
const handleMouseOver = useCallback(
2122
(placeId?: string, location?: [number, number]) => {
2223
if (placeId) {
24+
if (selection && placeId === selection.placeId) return;
2325
if (mouseOverTimeoutRef.current)
2426
clearTimeout(mouseOverTimeoutRef.current);
2527
mouseOverTimeoutRef.current = window.setTimeout(
@@ -28,7 +30,7 @@ const PlacesMarkers = function Markers() {
2830
);
2931
}
3032
},
31-
[setSelection],
33+
[selection, setSelection],
3234
);
3335

3436
const handleMouseOut = useCallback(

src/pages/dashboard/create/Markers.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ const Markers = memo(function Markers() {
1010

1111
const handleClick = useCallback(
1212
(placeId?: string, location?: [number, number]) => {
13+
if (selection && placeId === selection.placeId) return;
1314
if (placeId) setSelection({ placeId, location, source: "marker" });
1415
},
15-
[setSelection],
16+
[selection, setSelection],
1617
);
1718

1819
const handlePopupClose = useCallback(() => {

0 commit comments

Comments
 (0)