[Maps] Fix layer-flash when changing style (#80948)

This commit is contained in:
Thomas Neirynck 2020-10-19 15:57:48 -04:00 committed by GitHub
parent 2f01a0911c
commit db14725038
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -182,7 +182,10 @@ export class TiledVectorLayer extends VectorLayer {
const layerIds = this.getMbLayerIds();
for (let i = 0; i < layerIds.length; i++) {
const mbLayer = mbMap.getLayer(layerIds[i]);
if (mbLayer && mbLayer['source-layer'] !== tiledSourceMeta.layerName) {
// The mapbox type in the spec is specified with `source-layer`
// but the programmable JS-object uses camelcase `sourceLayer`
// @ts-expect-error
if (mbLayer && mbLayer.sourceLayer !== tiledSourceMeta.layerName) {
// If the source-pointer of one of the layers is stale, they will all be stale.
// In this case, all the mb-layers need to be removed and re-added.
return true;