mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-25 16:02:50 +00:00
Sanity check in source/layer update (#1022)
This commit is contained in:
parent
004993fef2
commit
30830b727b
@ -158,7 +158,7 @@ export default class Layer<Props: LayerProps> extends PureComponent<Props> {
|
||||
/* eslint-disable complexity */
|
||||
|
||||
_render(context: MapContextProps) {
|
||||
if (!this._map) {
|
||||
if (!this._map && context.map) {
|
||||
this._map = context.map;
|
||||
this._map.on('styledata', this._updateLayer);
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ export default class Source<Props: SourceProps> extends PureComponent<Props> {
|
||||
/* eslint-enable complexity */
|
||||
|
||||
_render(context: MapContextProps) {
|
||||
if (!this._map) {
|
||||
if (!this._map && context.map) {
|
||||
this._map = context.map;
|
||||
this._map.on('styledata', this._updateSource);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user