Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: There is no source with this ID when destroying a map with Ruler #7

Closed
brendanmatkin opened this issue Jul 31, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@brendanmatkin
Copy link

I'm using this in a Vue app, so the problem might be there, but I'm getting this no source with this ID Error whenever I destroy an instance of mapbox (e.g. changing pages, etc.).

Psuedo stack trace:
this.map.removeSource(SOURCE_LINE);
in Ruler.measuringOff()
called by Ruler.onRemove()
called by a mapbox onRemove() (not 100% sure where, but I would guess the bit that removes controls)

This only occurs if I haven't used the ruler yet, or if the ruler has been cleared. If I still have ruler lines/points on the map, I get an i[e].onRemove is not a function Error instead (I'm using webpack).

Either way everything seems to function normally, it's mostly just annoying to see errors all the time when I'm trying to debug! Plus it might break something important for someone later..

.
.
Possibly related to this fixed issue: mapbox/mapbox-gl-js#7478?

Maybe it's as simple as doing an isMeasuring check or an if map.getLayer(SOURCE_LINE)? I've poked around a bit and haven't got it working yet but I'm not really set up to test module edits at the moment. I'll give it a try later

@korywka
Copy link
Owner

korywka commented Jul 31, 2019

@brendanmatkin Thanks. Should work now.

@brendanmatkin
Copy link
Author

Awesome, thanks! So fast!!

I no long get the no source error.

I now get i[e].onRemove is not a function whether or not the ruler has been used, but that is likely a vue+webpack/babel or mapbox-gl problem. I'm in the middle of a refactor so after that I'll see if I can narrow it down later and post the result here. I'm fairly sure it's not a problem with this library..

@korywka korywka added the bug Something isn't working label Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants