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

Possible to removeLayers before addLayers #721

Closed
gpbmike opened this issue Dec 9, 2017 · 2 comments
Closed

Possible to removeLayers before addLayers #721

gpbmike opened this issue Dec 9, 2017 · 2 comments

Comments

@gpbmike
Copy link
Contributor

gpbmike commented Dec 9, 2017

mapbox-gl-js version: v0.42.2
mapbox-gl-draw version: v1.0.4

Steps to Trigger Behavior

  1. Add control.
  2. Remove control before map is loaded (before control.addLayers is called).

Expected Behavior

Control should check for layers/sources before trying to remove them.

Actual Behavior

Many errors are thrown related to missing layers/sources.

eg: The layer 'gl-draw-polygon-fill-static.hot' does not exist in the map's style

Additional Details

Contrived CodePen example: https://codepen.io/gpbmike/pen/EbqNmp

My use case: User navigates to route with map then quickly navigates away before the map loads.

@mcwhittemore
Copy link
Contributor

Hmmm... yea it looks like even map.removeControl(Draw) has to be called after map.on('load', () => {}) has been triggered.

I'm guessing we just need some extra handling here.

@gpbmike
Copy link
Contributor Author

gpbmike commented Jun 15, 2018

This looks like it was fixed sometime between v1.0.4 and v1.0.9. Perhaps by me? #685 😅

@gpbmike gpbmike closed this as completed Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants