mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-25 16:02:50 +00:00
Add sanity check before adding layer (#1735)
This commit is contained in:
parent
dd35d0eecc
commit
33cd502536
@ -61,7 +61,7 @@ function updateLayer(map: MapboxMap, id: string, props: LayerProps, prevProps: L
|
||||
|
||||
function createLayer(map: MapboxMap, id: string, props: LayerProps) {
|
||||
// @ts-ignore
|
||||
if (map.style && map.style._loaded) {
|
||||
if (map.style && map.style._loaded && map.getSource(props.source)) {
|
||||
const options: LayerProps = {...props, id};
|
||||
delete options.beforeId;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user