diff --git a/src/components/Map/Map.tsx b/src/components/Map/Map.tsx index ac7cff7..6ce1321 100644 --- a/src/components/Map/Map.tsx +++ b/src/components/Map/Map.tsx @@ -34,7 +34,7 @@ function Map(props: MainPageProps): JSX.Element { const {offers, selectedPoint} = props; const mapRef = useRef(null); - const map = useMap(mapRef, "Амстердам"); + const map = useMap(mapRef, 'Амстердам'); useEffect(() => { if (map) { @@ -57,7 +57,7 @@ function Map(props: MainPageProps): JSX.Element { map.removeLayer(markerLayer); }; } - }, [map, offers]); + }, [map, offers,selectedPoint]); return
; } diff --git a/src/hooks/use-map.tsx b/src/hooks/use-map.tsx index dc12e3a..e8f617d 100644 --- a/src/hooks/use-map.tsx +++ b/src/hooks/use-map.tsx @@ -29,7 +29,7 @@ function useMap( instance.addLayer(layer); setMap(instance); - isRenderedRef.current = true + isRenderedRef.current = true; } }, [mapRef, city]);