mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Maps] ensure resiveChecker exists before calling destroy (#30032)
This commit is contained in:
parent
9b1e2d454f
commit
de2d0b647c
1 changed files with 7 additions and 1 deletions
|
@ -53,7 +53,9 @@ export class MBMapContainer extends React.Component {
|
|||
|
||||
componentWillUnmount() {
|
||||
this._isMounted = false;
|
||||
this._checker.destroy();
|
||||
if (this._checker) {
|
||||
this._checker.destroy();
|
||||
}
|
||||
if (this._mbMap) {
|
||||
this._mbMap.remove();
|
||||
this._mbMap = null;
|
||||
|
@ -65,6 +67,10 @@ export class MBMapContainer extends React.Component {
|
|||
|
||||
this._mbMap = await createMbMapInstance(this.refs.mapContainer, this.props.goto ? this.props.goto.center : null);
|
||||
|
||||
if (!this._isMounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Override mapboxgl.Map "on" and "removeLayer" methods so we can track layer listeners
|
||||
// Tracked layer listerners are used to clean up event handlers
|
||||
const originalMbBoxOnFunc = this._mbMap.on;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue