From 578a920b6de82b9b9690d4ea75c48fdb03f54fb2 Mon Sep 17 00:00:00 2001 From: orangemug Date: Mon, 13 Apr 2020 08:39:23 +0100 Subject: [PATCH 1/2] Fixed crash raised in issue #647 --- src/components/map/MapboxGlMap.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index 02ddc8d..d48f423 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -110,11 +110,11 @@ export default class MapboxGlMap extends React.Component { this.state.inspect._popupBlocked = false; this.state.inspect.toggleInspector() } - if(this.props.inspectModeEnabled) { - this.state.inspect.render() - } - if (map) { + if (this.props.inspectModeEnabled) { + this.state.inspect.render(); + } + map.showTileBoundaries = this.props.options.showTileBoundaries; map.showCollisionBoxes = this.props.options.showCollisionBoxes; map.showOverdrawInspector = this.props.options.showOverdrawInspector; From 1070209cb5a2039d1b2bc0aaefc66b14a8501439 Mon Sep 17 00:00:00 2001 From: orangemug Date: Tue, 14 Apr 2020 09:11:09 +0100 Subject: [PATCH 2/2] Another attempt and maputnik inspect crashing issue. --- src/components/map/MapboxGlMap.jsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index d48f423..e6ef90b 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -104,7 +104,7 @@ export default class MapboxGlMap extends React.Component { this.updateMapFromProps(this.props); - if(this.props.inspectModeEnabled !== prevProps.inspectModeEnabled) { + if(this.state.inspect && this.props.inspectModeEnabled !== this.state.inspect._showInspectMap) { // HACK: Fix for , while we wait for a proper fix. // eslint-disable-next-line this.state.inspect._popupBlocked = false; @@ -112,7 +112,14 @@ export default class MapboxGlMap extends React.Component { } if (map) { if (this.props.inspectModeEnabled) { - this.state.inspect.render(); + // HACK: We need to work out why we need to do this and what's causing + // this error. I'm assuming an issue with mapbox-gl update and + // mapbox-gl-inspect. + try { + this.state.inspect.render(); + } catch(err) { + console.error("FIXME: Caught error", err); + } } map.showTileBoundaries = this.props.options.showTileBoundaries; @@ -182,9 +189,6 @@ export default class MapboxGlMap extends React.Component { inspect, zoom: map.getZoom() }); - if(this.props.inspectModeEnabled) { - inspect.toggleInspector(); - } }) map.on("data", e => {