Skip to content

Commit 76b26d2

Browse files
author
David Emory
committed
fix(map): Clear transitive overlay data when unmounting component
1 parent 19c5bd5 commit 76b26d2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/components/map/transitive-overlay.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class TransitiveCanvasOverlay extends MapLayer {
5151

5252
componentWillReceiveProps (nextProps) {
5353
// Check if we received new transitive data
54-
if (!isEqual(nextProps.transitiveData, this.props.transitiveData)) {
54+
if (this._transitive && !isEqual(nextProps.transitiveData, this.props.transitiveData)) {
5555
this._transitive.updateData(nextProps.transitiveData)
5656
if (!nextProps.transitiveData) this._transitive.render()
5757
else this._updateBoundsAndRender()
@@ -71,7 +71,12 @@ class TransitiveCanvasOverlay extends MapLayer {
7171
}
7272
}
7373

74-
componentWillUnmount () { }
74+
componentWillUnmount () {
75+
if (this._transitive) {
76+
this._transitive.updateData(null)
77+
this._transitive.render()
78+
}
79+
}
7580

7681
// Internal Methods
7782

0 commit comments

Comments
 (0)