From 6da567edd29d21cbd4d0fd7aa9082c514931d1e8 Mon Sep 17 00:00:00 2001 From: Daniel Koch Date: Wed, 7 Aug 2019 17:42:23 +0200 Subject: [PATCH] Unset the map's target on unmount --- src/Map/MapComponent/MapComponent.jsx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Map/MapComponent/MapComponent.jsx b/src/Map/MapComponent/MapComponent.jsx index b8c4b16768..e9558f31ac 100644 --- a/src/Map/MapComponent/MapComponent.jsx +++ b/src/Map/MapComponent/MapComponent.jsx @@ -30,20 +30,32 @@ export class MapComponent extends PureComponent { /** * Create a MapComponent. - * - * @constructs Map */ constructor(props) { super(props); } /** - * The componentDidMount function - * - * @method componentDidMount + * The componentDidMount function. */ componentDidMount() { - this.props.map.setTarget(this.props.mapDivId); + const { + map, + mapDivId + } = this.props; + + map.setTarget(mapDivId); + } + + /** + * The componentWillUnmount function. + */ + componentWillUnmount() { + const { + map + } = this.props; + + map.setTarget(null); } /**