mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Maps] fix zooming while drawing shape filter logs errors in console (#88413)
* [Maps] fix zooming while drawing shape filter logs errors in console * add unit test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
fbb8238f57
commit
c66c9424d9
2 changed files with 17 additions and 0 deletions
|
@ -185,4 +185,16 @@ describe('removeOrphanedSourcesAndLayers', () => {
|
|||
removeOrphanedSourcesAndLayers(mockMbMap, [], spatialFilterLayer);
|
||||
expect(mockMbMap.getStyle()).toEqual(styleWithSpatialFilters);
|
||||
});
|
||||
|
||||
test('should not remove mapbox gl draw layers and sources', async () => {
|
||||
const fooLayer = makeMultiSourceMockLayer('foo');
|
||||
const layerList = [fooLayer];
|
||||
|
||||
const currentStyle = getMockStyle(layerList);
|
||||
currentStyle.layers.push({ id: 'gl-draw-points' });
|
||||
const mockMbMap = new MockMbMap(currentStyle);
|
||||
|
||||
removeOrphanedSourcesAndLayers(mockMbMap, layerList, spatialFilterLayer);
|
||||
expect(mockMbMap.getStyle()).toEqual(currentStyle);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,6 +16,11 @@ export function removeOrphanedSourcesAndLayers(mbMap, layerList, spatialFilterLa
|
|||
return;
|
||||
}
|
||||
|
||||
// ignore gl-draw layers
|
||||
if (mbLayer.id.startsWith('gl-draw')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const layer = layerList.find((layer) => {
|
||||
return layer.ownsMbLayerId(mbLayer.id);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue