Sanity check in source/layer update (#1022)

This commit is contained in:
Xiaoji Chen 2020-02-10 14:57:13 -08:00 committed by GitHub
parent 004993fef2
commit 30830b727b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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);
}

View File

@ -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);
}