Templates Plugins Courses

MapBox Style Loading Problem


I am having an issue with the MapBox Plugin (as awesome as it is, thank you!) where setting the style can fail if it is set too soon after page load starts.

I want the map to show up in the custom dark style I created in MapBox Studio. Everything is set up properly, but the page loads, the map shows up as the default theme and I get this error:

“Action Set Style Map”

The plugin MapBox Maps / action Set Style a MapBox Map threw the following error: TypeError: Cannot read property ‘parentNode’ of undefined
at MapboxDirections.onRemove (https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-directions/v4.0.2/mapbox-gl-directions.js:7337:22)
at r.removeControl (https://api.tiles.mapbox.com/mapbox-gl-js/v1.4.1/mapbox-gl.js:33:290747) (please report this to the plugin author)

If I introduce a pause action before the Map Style action, it will work as long as the pause is long enough. I need to set it well over a second to ensure it works, but there’s no way to know if on a slower internet connection the map style set would fail.

Two things: Is there something I can do to remedy this? To only set the style once the map has loaded, but only show the map once the style is loaded?

Also, since I know I don’t want to load the map’s default style, is there a way to set the map style in the editor, so it will NEVER try to load the default style? That would be an amazing feature!



Hello Alex,

Thank you for reaching out and reporting the problem.

We will develop a functionality integrated into the plugin in order to fix the error reported by you. Regarding uploading the map with default custom style, unfortunately, it is not possible to do.

I will inform you when the plugin will be updated.

Best Regards,

Hello @alex2,

The plugin is updated. Now the issue with style loading is fixed. Please update the plugin to the latest version.

Best Regards,