mapbox-gl-js version: 1.2.1
browser: Chrome(_76.0.3809.100_) and Firefox(_68.0.2_)
setStyle()This can be seen in this official example.
I've also added a basic example derived from the _setStyle_ example which only adds another layer to the map. If you change the map style, this layer will be removed.
https://jsbin.com/yekisosehe/1/edit?html,console,output
Change the map style and do NOT remove all the existing layers. This is critical, as in my case, I have a great deal of layers, sources and markers on the map and removing them when switching styles is a deal breaker.
Changes the map style and generates a warning in the console.
Unable to perform style diff: Unimplemented: setSprite.. Rebuilding the style from scratch.
Any known way to work around this and not rerender all the layers? Maybe I'm missing something obvious, but I don't think this should be the behaviour. I know there are some related issues such as 8241, 2058 or 2059 but with no conclusive answers.
I believe this is #4006. That thread has some discussion on possible solutions, but generally the expectation is with you to either re-add those sources/layers after setStyle or even better integrate them into your Style JSON you pass to setStyle so that the smart diff which powers setStyle can retain them.
@andrewharvey thanks for chiming in, seconded. Closing as a duplicate of #4006.
Most helpful comment
I believe this is #4006. That thread has some discussion on possible solutions, but generally the expectation is with you to either re-add those sources/layers after setStyle or even better integrate them into your Style JSON you pass to setStyle so that the smart diff which powers setStyle can retain them.