fix auto zoom to do it only on new map selections
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m9s
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m9s
This commit is contained in:
@@ -39,7 +39,7 @@ function MapController() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function AutoZoom({ mapId, refreshTrigger }: { mapId: string; refreshTrigger: number }) {
|
||||
function AutoZoom({ mapId }: { mapId: string }) {
|
||||
const map = useMap();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -78,7 +78,7 @@ function AutoZoom({ mapId, refreshTrigger }: { mapId: string; refreshTrigger: nu
|
||||
};
|
||||
|
||||
zoomToDevices();
|
||||
}, [mapId, refreshTrigger, map]);
|
||||
}, [mapId, map]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ export function MapView({ mapId, activeLayer, mapLayers, showShareDialog = false
|
||||
style={{ background: '#f0f0f0' }}
|
||||
>
|
||||
<MapController />
|
||||
<AutoZoom mapId={mapId} refreshTrigger={refreshTrigger} />
|
||||
<AutoZoom mapId={mapId} />
|
||||
<TileLayer
|
||||
key={activeLayer}
|
||||
url={layer.url}
|
||||
|
||||
@@ -57,7 +57,7 @@ function MapController() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function AutoZoom({ mapId, refreshTrigger }: { mapId: string; refreshTrigger: number }) {
|
||||
function AutoZoom({ mapId }: { mapId: string }) {
|
||||
const map = useMap();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -96,7 +96,7 @@ function AutoZoom({ mapId, refreshTrigger }: { mapId: string; refreshTrigger: nu
|
||||
};
|
||||
|
||||
zoomToDevices();
|
||||
}, [mapId, refreshTrigger, map]);
|
||||
}, [mapId, map]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ export function SharedMap() {
|
||||
style={{ background: '#f0f0f0' }}
|
||||
>
|
||||
<MapController />
|
||||
<AutoZoom mapId={mapData.id} refreshTrigger={refreshTrigger} />
|
||||
<AutoZoom mapId={mapData.id} />
|
||||
<TileLayer
|
||||
key={activeLayer}
|
||||
url={MAP_LAYERS[activeLayer].url}
|
||||
|
||||
Reference in New Issue
Block a user