From e5c56272d7c94b948a56f0919f067ff8b6f9e63a Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 19 Jul 2026 02:40:59 +0200 Subject: [PATCH] Stabilize programmatic map fitting --- backend/tests/test_sprint186_map_first_geographic_explorer.py | 2 +- frontend/src/components/GeoMap.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/tests/test_sprint186_map_first_geographic_explorer.py b/backend/tests/test_sprint186_map_first_geographic_explorer.py index 6c3e1877..a1a6c804 100644 --- a/backend/tests/test_sprint186_map_first_geographic_explorer.py +++ b/backend/tests/test_sprint186_map_first_geographic_explorer.py @@ -47,7 +47,7 @@ def test_map_rectangle_drag_is_wired_to_automatic_analysis() -> None: assert "new ResizeObserver" in geomap assert "resizeObserver.observe(containerRef.current)" in geomap assert "fitDataOnChangeRef.current" in geomap - assert "map.fitBounds(bounds, { padding: 40, duration: 0 })" in geomap + assert geomap.count("map.fitBounds(bounds, { padding: 40, duration: 0 })") == 3 assert "const activeCollection = areaData ?? (fitDataOnChange ? data : null)" in geomap assert "data && fitDataOnChange && !areaData" in geomap assert "resizeObserver.disconnect()" in geomap diff --git a/frontend/src/components/GeoMap.tsx b/frontend/src/components/GeoMap.tsx index 388b95ec..cd28de99 100644 --- a/frontend/src/components/GeoMap.tsx +++ b/frontend/src/components/GeoMap.tsx @@ -426,7 +426,7 @@ function GeoMap({ if (collection.type === 'FeatureCollection' && collection.features.length > 0) { const bounds = collectCoordinates(collection) if (bounds) { - map.fitBounds(bounds, { padding: 40 }) + map.fitBounds(bounds, { padding: 40, duration: 0 }) } } } @@ -497,7 +497,7 @@ function GeoMap({ if (activeCollection) { const bounds = collectCoordinates(activeCollection) if (bounds) { - map.fitBounds(bounds, { padding: 40 }) + map.fitBounds(bounds, { padding: 40, duration: 0 }) } } }, [areaData, data, fitDataOnChange, mapStyleReady])