Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fix useEffect to update on proj change (#6910)

Tom Cariellod519c54196d1
diff --git a/web/js/containers/map-interactions/ol-vector-interactions.js b/web/js/containers/map-interactions/ol-vector-interactions.js
index a6fd28904..763e70008 100644
--- a/web/js/containers/map-interactions/ol-vector-interactions.js
+++ b/web/js/containers/map-interactions/ol-vector-interactions.js
@@ -107,12 +107,15 @@ export function VectorInteractions(props) {
events.on(MAP_SINGLE_CLICK, singleClick);
return () => {
+ mouseMoveThrottled.cancel();
+ mouseOutThrottled.cancel();
+
events.off(MAP_MOVE_END, moveEnd);
events.off(MAP_MOUSE_MOVE, mouseMoveThrottled);
events.off(MAP_MOUSE_OUT, mouseOutThrottled);
events.off(MAP_SINGLE_CLICK, singleClick);
};
- }, []);
+ }, [proj?.id, proj?.selected?.crs]);
useEffect(() => {
if (granuleDate && prevGranuleFootprints !== granuleFootprints) {
diff --git a/web/js/map/granule/util.js b/web/js/map/granule/util.js
index 2868be162..6ca8770a9 100644
--- a/web/js/map/granule/util.js
+++ b/web/js/map/granule/util.js
@@ -391,7 +391,7 @@ export const areCoordinatesAndPolygonExtentValid = (points, coords, maxExtent) =
const polygon = new OlGeomPolygon([points]);
const areCoordsWithinPolygon = polygon.intersectsCoordinate(coords);
- // check is polygon footprint is within max extent, will allow partial corners within max extent
+ // check if polygon footprint is within max extent, will allow partial corners within max extent
const doesPolygonIntersectMaxExtent = polygon.intersectsExtent(maxExtent);
// check if polygon is larger than maxExtent - helpful to catch most large polar granules
const polygonExtent = polygon.getExtent();