mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Geomap: Ensure options work while in table view (#62632)
This commit is contained in:
parent
55e7cf1aed
commit
cf6952a963
@ -82,6 +82,8 @@ export class GeomapPanel extends Component<Props, State> {
|
|||||||
for (const lyr of this.layers) {
|
for (const lyr of this.layers) {
|
||||||
lyr.handler.dispose?.();
|
lyr.handler.dispose?.();
|
||||||
}
|
}
|
||||||
|
// Ensure map is disposed
|
||||||
|
this.map?.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: Props) {
|
shouldComponentUpdate(nextProps: Props) {
|
||||||
@ -183,15 +185,15 @@ export class GeomapPanel extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initMapRef = async (div: HTMLDivElement) => {
|
initMapRef = async (div: HTMLDivElement) => {
|
||||||
|
if (!div) {
|
||||||
|
// Do not initialize new map or dispose old map
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.mapDiv = div;
|
this.mapDiv = div;
|
||||||
if (this.map) {
|
if (this.map) {
|
||||||
this.map.dispose();
|
this.map.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!div) {
|
|
||||||
this.map = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { options } = this.props;
|
const { options } = this.props;
|
||||||
|
|
||||||
const map = getNewOpenLayersMap(this, options, div);
|
const map = getNewOpenLayersMap(this, options, div);
|
||||||
|
Loading…
Reference in New Issue
Block a user