question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error removing layer when using mapbox-gl 0.43.0

See original GitHub issue

Mapbox-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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
alex3165commented, Jan 31, 2018

Released with tag 3.5.0 of react-mapbox-gl

2reactions
Wykkscommented, Jan 9, 2018

Yup 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found