[v9.4.x] Geomap: Ensure options work while in table view (#62635)

Geomap: Ensure options work while in table view (#62632)

(cherry picked from commit cf6952a963)

Co-authored-by: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2023-01-31 15:31:54 -08:00
committed by GitHub
co-authored by Drew Slobodnjak
parent c156621981
commit 2bb672a7de
@@ -82,6 +82,8 @@ export class GeomapPanel extends Component<Props, State> {
for (const lyr of this.layers) {
lyr.handler.dispose?.();
}
// Ensure map is disposed
this.map?.dispose();
}
shouldComponentUpdate(nextProps: Props) {
@@ -183,15 +185,15 @@ export class GeomapPanel extends Component<Props, State> {
}
initMapRef = async (div: HTMLDivElement) => {
if (!div) {
// Do not initialize new map or dispose old map
return;
}
this.mapDiv = div;
if (this.map) {
this.map.dispose();
}
if (!div) {
this.map = undefined;
return;
}
const { options } = this.props;
const map = getNewOpenLayersMap(this, options, div);