Error removing layer when using mapbox-gl 0.43.0
See original GitHub issueMapbox-gl v0.43.0 introduces a breaking change that throws an error if a source is removed while still in use (e.g. remove a source prior to removing layers that use the source, https://github.com/mapbox/mapbox-gl-js/pull/5562 ). This was discovered in #491.
Example error:
mapbox-gl.js:546 Error: Source "example_id" cannot be removed while layer "example_id_marker" is using it.
at t.removeSource (mapbox-gl.js:406)
at e.removeSource (mapbox-gl.js:520)
at Source.componentWillUnmount (source.js:71)
at callComponentWillUnmountWithTimerInDev (react-dom.development.js:11117)
at HTMLUnknownElement.callCallback (react-dom.development.js:1299)
at Object.invokeGuardedCallbackDev (react-dom.development.js:1338)
at invokeGuardedCallback (react-dom.development.js:1195)
at safelyCallComponentWillUnmount (react-dom.development.js:11125)
at commitUnmount (react-dom.development.js:11415)
at unmountHostComponents (react-dom.development.js:11356)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
mapbox-gl/CHANGELOG.md - UNPKG
267, - Fixed a bug where calling `Map#removeFeatureState` does not remove the state from some tile zooms [#8087](https://github.com/mapbox/mapbox-gl-js/pull/ ...
Read more >Sources | Style Specification | Mapbox GL JS
A map or layer source states which data the map should display. Specify the type of source with the "type" property, which must...
Read more >inst/node_modules/mapbox-gl/CHANGELOG.md - Rdrr.io
0.43.0 (December 21, 2017). ⚠️ Breaking changes. It is now an error to attempt to remove a source that is in use #5562;...
Read more >map-gl-utils - npm Package Health Analysis | Snyk
Utility functions for Mapbox GL JS or Maplibre GL JS For more information ... (not an error if layer doesn't exist), removeSource() (removes...
Read more >Tutorial: MapBoxGL HexBin Map / Chris Henrick - Observable
final = Error: Unable to load file: Screen Shot 2020-04-20 at 9.59.05 AM.png ... For more on how to use MapboxGL with Observable,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Released with tag
3.5.0
of react-mapbox-glYup I had to deal with this change in ngx-mapbox-gl too (https://github.com/Wykks/ngx-mapbox-gl/issues/10). @alex3165 Instead of calling mapbox-gl method directly, we can buffer the removes request, then in the same frame after react work if possible process the removes in a defined order.