diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index 02ddc8d..e6ef90b 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -104,17 +104,24 @@ 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; this.state.inspect.toggleInspector() } - if(this.props.inspectModeEnabled) { - this.state.inspect.render() - } - if (map) { + if (this.props.inspectModeEnabled) { + // 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; map.showCollisionBoxes = this.props.options.showCollisionBoxes; map.showOverdrawInspector = this.props.options.showOverdrawInspector; @@ -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 => {