From ff6ef3856b3dcfec52588407b1ba5df23be9ce5a Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 19 Oct 2020 15:57:48 -0400 Subject: [PATCH] [Maps] Fix layer-flash when changing style (#80948) --- .../classes/layers/tiled_vector_layer/tiled_vector_layer.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx index 68b9f2931f398..95a452c7ce376 100644 --- a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx @@ -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;