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

This commit is contained in:
Drew Slobodnjak 2023-01-31 12:24:13 -08:00 committed by GitHub
parent 55e7cf1aed
commit cf6952a963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);