Skip to content

Commit 3d27210

Browse files
fix: rerender overlay on draggable prop change for correct drag implementation
Current issue: We have different modes for drawing figures on the map and placing markers, that is why draggable prop is changed dynamically depending on the mode selected. At the moment to rerender overlay we do deep comparison only on lat and lng props change, do not taking into account draggable prop which causes incorrect behaviour
1 parent 77905eb commit 3d27210

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/map/overlay-view.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const OverlayView = ({
2828
// This fixes the issue where the overlay is not updated when the position changes.
2929
const childrenProps = useMemoCompare(
3030
children?.props as any,
31-
(prev: { lat: any; lng: any }, next: { lat: any; lng: any }) =>
32-
prev && prev.lat === next.lat && prev.lng === next.lng,
31+
(prev: { lat: any; lng: any; draggable: boolean }, next: { lat: any; lng: any; draggable: boolean }) =>
32+
prev && prev.lat === next.lat && prev.lng === next.lng && prev.draggable === next.draggable; ,
3333
)
3434

3535
useEffect(() => {

0 commit comments

Comments
 (0)