diff --git a/public/app/plugins/panel/geomap/GeomapPanel.tsx b/public/app/plugins/panel/geomap/GeomapPanel.tsx index 151192bae4c..3f389f37f74 100644 --- a/public/app/plugins/panel/geomap/GeomapPanel.tsx +++ b/public/app/plugins/panel/geomap/GeomapPanel.tsx @@ -149,8 +149,7 @@ export class GeomapPanel extends Component { optionsChanged(options: Options) { const oldOptions = this.props.options; if (options.view !== oldOptions.view) { - const [updatedSharedView, view] = this.initMapView(options.view, sharedView); - sharedView = updatedSharedView; + const view = this.initMapView(options.view); if (this.map && view) { this.map.setView(view); @@ -176,7 +175,7 @@ export class GeomapPanel extends Component { // Because data changed, check map view and change if needed (data fit) const v = centerPointRegistry.getIfExists(this.props.options.view.id); if (v && v.id === MapCenterID.Fit) { - const [, view] = this.initMapView(this.props.options.view); + const view = this.initMapView(this.props.options.view); if (this.map && view) { this.map.setView(view); @@ -250,7 +249,7 @@ export class GeomapPanel extends Component { pointerMoveListener(evt, this); }; - initMapView = (config: MapViewConfig, sharedView?: View | undefined): Array => { + initMapView = (config: MapViewConfig): View | undefined => { let view = new View({ center: [0, 0], zoom: 1, @@ -265,9 +264,9 @@ export class GeomapPanel extends Component { view = sharedView; } } - this.initViewExtent(view, config); - return [sharedView, view]; + this.initViewExtent(view, config); + return view; }; initViewExtent(view: View, config: MapViewConfig) { diff --git a/public/app/plugins/panel/geomap/utils/utils.ts b/public/app/plugins/panel/geomap/utils/utils.ts index 865497c7fa7..6587dda7ee2 100644 --- a/public/app/plugins/panel/geomap/utils/utils.ts +++ b/public/app/plugins/panel/geomap/utils/utils.ts @@ -75,7 +75,7 @@ async function initGeojsonFiles() { } export const getNewOpenLayersMap = (panel: GeomapPanel, options: Options, div: HTMLDivElement) => { - const [view] = panel.initMapView(options.view, undefined); + const view = panel.initMapView(options.view); return (panel.map = new OpenLayersMap({ view: view, pixelRatio: 1, // or zoom?