diff --git a/src/frontend/package.json b/src/frontend/package.json index 26db65d5..0b752e67 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -2,7 +2,7 @@ "dependencies": { "@cyntler/react-doc-viewer": "^1.17.0", "@geomatico/maplibre-cog-protocol": "^0.3.1", - "@hotosm/gcp-editor": "^0.0.6", + "@hotosm/gcp-editor": "^0.0.8", "@mapbox/mapbox-gl-draw": "^1.4.2", "@mapbox/mapbox-gl-draw-static-mode": "^1.0.1", "@radix-ui/react-popover": "^1.0.6", diff --git a/src/frontend/src/components/IndividualProject/GcpEditor/index.tsx b/src/frontend/src/components/IndividualProject/GcpEditor/index.tsx index 682df212..21a152e0 100644 --- a/src/frontend/src/components/IndividualProject/GcpEditor/index.tsx +++ b/src/frontend/src/components/IndividualProject/GcpEditor/index.tsx @@ -32,12 +32,15 @@ const GcpEditor = ({ }; useEffect(() => { - document.addEventListener(CUSTOM_EVENT, data => { - startProcessing(data); - }); - return document.removeEventListener(CUSTOM_EVENT, data => { - startProcessing(data); - }); + document.addEventListener( + CUSTOM_EVENT, + data => { + startProcessing(data); + }, + // When we use the {once: true} option when adding an event listener, the listener will be invoked at most once and immediately removed as soon as the event is invoked. + { once: true }, + ); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [CUSTOM_EVENT, dispatch]); diff --git a/src/frontend/src/views/IndividualProject/index.tsx b/src/frontend/src/views/IndividualProject/index.tsx index cad86267..1dc5cdfd 100644 --- a/src/frontend/src/views/IndividualProject/index.tsx +++ b/src/frontend/src/views/IndividualProject/index.tsx @@ -145,10 +145,10 @@ const IndividualProject = () => { close ) : (