diff --git a/frontend/src/components/map/index.tsx b/frontend/src/components/map/index.tsx index 2eb48172..c935dcec 100644 --- a/frontend/src/components/map/index.tsx +++ b/frontend/src/components/map/index.tsx @@ -54,16 +54,19 @@ export const Map: FC = ({ const handleFitBounds = useCallback(() => { if (mapRef && bounds) { const { bbox, options } = bounds; - // enabling fly mode avoids the map to be interrupted during the bounds transition - setFlying(true); - - mapRef.fitBounds( - [ - [bbox[0], bbox[1]], - [bbox[2], bbox[3]], - ], - options - ); + + if (bbox) { + // enabling fly mode avoids the map to be interrupted during the bounds transition + setFlying(true); + + mapRef.fitBounds( + [ + [bbox[0], bbox[1]], + [bbox[2], bbox[3]], + ], + options + ); + } } }, [bounds, mapRef]);