mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-25 16:02:50 +00:00
Fix crash during Source component removal (#928)
This commit is contained in:
parent
734b1114be
commit
d1cb92dffd
@ -48,7 +48,12 @@ export default class Source<Props: SourceProps> extends PureComponent<Props> {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this._map.removeSource(this.id);
|
||||
/* global requestAnimationFrame */
|
||||
// Do not remove source immediately because the
|
||||
// dependent <Layer>s' componentWillUnmount() might not have been called
|
||||
// Removing source before dependent layers will throw error
|
||||
// TODO - find a more robust solution
|
||||
requestAnimationFrame(() => this._map.removeSource(this.id));
|
||||
}
|
||||
|
||||
id: string;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user