Skip to content

Commit

Permalink
[Maps] fix zooming while drawing shape filter logs errors in console (#…
Browse files Browse the repository at this point in the history
…88413) (#88553)

* [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>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
nreese and kibanamachine authored Jan 16, 2021
1 parent eadee7e commit 7c9eb94
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 7c9eb94

Please sign in to comment.