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

addLayer with inline source mutates its input #4040

Closed
jfirebaugh opened this issue Jan 24, 2017 · 0 comments
Closed

addLayer with inline source mutates its input #4040

jfirebaugh opened this issue Jan 24, 2017 · 0 comments

Comments

@jfirebaugh
Copy link
Contributor

jfirebaugh commented Jan 24, 2017

addLayer with an inline source will mutate the argument, replacing the source object with the layer's id. Runtime styling APIs should never mutate their input, as users may want to reuse the input, or otherwise expect it not to change outside their control.

var source = { ... };
var layer = { ..., source: source };
map.addLayer(layer);
assert(source === layer.source); // should pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants