(false)
+
+ const {mapSnapshot, takeMapSnapshot} = useMapSnapshot()
+
useMapFocus(mapRef, selectedLocation)
const fetchFmu = async () => {
@@ -123,10 +132,18 @@ export default function MapPage() {
setError(null)
}
+ useEffect(() => {
+ if (currentFmu) {
+ takeMapSnapshot(mapRef, selectedLocation)
+ // setPdfDocument(pdf({ document: }))
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [currentFmu])
+
useEffect(() => {
fetchFmu().catch((e) => console.error(e))
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [selectedLocation, setError, mapSnapshot])
+ }, [selectedLocation, setError])
useEscapeKey(() => {
selectLocation(null)
@@ -217,11 +234,7 @@ export default function MapPage() {
}
}
- const afterMapLoaded = () => {
- if (locationDetails) {
- selectLocation(locationDetails as IMViewLocation)
- }
- }
+ const afterMapLoaded = () => {}
return (
@@ -291,7 +304,7 @@ export default function MapPage() {
id={CURRENT_FMU_LAYER}
type="fill"
paint={mapProperties.currentFMU.fill}
- filter={['==', ['id'], currentFmu?.freshwaterManagementUnit?.id]}
+ filter={['==', ['id'], currentFmu?.freshwaterManagementUnit?.id ?? null]}
source={FMU_BOUNDARIES_SOURCE}
maxzoom={DEFAULT_ZOOM+5}
/>)}
@@ -311,7 +324,8 @@ export default function MapPage() {
{currentFmu && (
- setSliderWidth(width)}
onClose={() => clearFmus()}>
{/*{currentFmus.length > 1 && ()}*/}
{selectedLocation?.address && }
@@ -324,6 +338,7 @@ export default function MapPage() {
{`Catchment ${fmuIndex! + 1} of ${currentFmus.length}`}
)}
+