Skip to content

Build your personal knowledge base with Trilium Notes

fix(geomap): don't crash MapLibre with a full-world maxBounds

Elian Doranff3020bce6b1
diff --git a/apps/client/src/widgets/collections/geomap/map.tsx b/apps/client/src/widgets/collections/geomap/map.tsx
index 64ae72d2cd..6b27f80fb6 100644
--- a/apps/client/src/widgets/collections/geomap/map.tsx
+++ b/apps/client/src/widgets/collections/geomap/map.tsx
@@ -84,7 +84,13 @@ export default function Map({ coordinates, zoom, layerData, viewportChanged, chi
center: toCenter(coordinates),
zoom,
minZoom: 2,
- maxBounds: [ [ -180, -90 ], [ 180, 90 ] ],
+ // No explicit maxBounds: a bounds whose longitude range spans the full world
+ // (-180..180) crashes MapLibre — the east edge wraps to -180, collapsing the range
+ // to zero width and making the constrain zoom infinite (a singular-matrix null
+ // deref). With renderWorldCopies disabled, MapLibre itself constrains panning to a
+ // single world (substituting an almost-full-world longitude range that avoids the
+ // collapse) and clamps latitude to the Mercator limit, which is the Leaflet-parity
+ // behavior we want.
renderWorldCopies: false
});