Skip to content

Commit

Permalink
[Maps] fix zooming while drawing shape filter logs errors in console (e…
Browse files Browse the repository at this point in the history
…lastic#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>
  • Loading branch information
nreese and kibanamachine committed Jan 16, 2021
1 parent 7bdac0b commit fbdcdf7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit fbdcdf7

Please sign in to comment.