diff --git a/client/src/components/Collections/CollectionMap.tsx b/client/src/components/Collections/CollectionMap.tsx index c0fce5fcc..0c3b56780 100644 --- a/client/src/components/Collections/CollectionMap.tsx +++ b/client/src/components/Collections/CollectionMap.tsx @@ -20,9 +20,6 @@ interface CollectionMapProps { */ export default function CollectionMap({ places, selectedPlaceId, onOpenPlace, onDeselect, dark }: CollectionMapProps): React.ReactElement { const pts = mappablePlaces(places) - const center: [number, number] = pts.length > 0 - ? [pts[0].lat as number, pts[0].lng as number] - : [48.8566, 2.3522] const tileUrl = dark ? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png' : 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png' @@ -35,8 +32,8 @@ export default function CollectionMap({ places, selectedPlaceId, onOpenPlace, on hoverDisabled onMarkerClick={onOpenPlace} onMapClick={onDeselect ? () => onDeselect() : undefined} - center={center} - zoom={pts.length > 0 ? 6 : 3} + // No center/zoom: the map frames itself on the collection's places at mount, and + // falls back to the world view for a collection with none. tileUrl={tileUrl} fitKey={pts.length} /> diff --git a/client/src/components/Map/MapView.test.tsx b/client/src/components/Map/MapView.test.tsx index b1cd71ea5..8d843e6e9 100644 --- a/client/src/components/Map/MapView.test.tsx +++ b/client/src/components/Map/MapView.test.tsx @@ -18,7 +18,10 @@ const mapMock = vi.hoisted(() => ({ })) vi.mock('react-leaflet', () => ({ - MapContainer: ({ children }: any) =>