Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/HeatmapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@ exports.default = (0, _reactLeaflet.withLeaflet)((_temp = _class = function (_Ma
};

HeatmapLayer.prototype.redraw = function redraw() {
// It's possible that the map has unmounted while we've waited for an animation frame, so we
// need to check that it still exists before proceeding with the redraw.
if (!this.props.leaflet.map._mapPane) {
return;
}

var r = this._heatmap._r;
var size = this.props.leaflet.map.getSize();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-leaflet-heatmap-layer",
"version": "2.0.0",
"version": "2.0.1",
"description": "A custom layer for heatmaps in react-leaflet",
"main": "lib/HeatmapLayer.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions src/HeatmapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ export default withLeaflet(class HeatmapLayer extends MapLayer {
}

redraw(): void {
// It's possible that the map has unmounted while we've waited for an animation frame, so we
// need to check that it still exists before proceeding with the redraw.
if (!this.props.leaflet.map._mapPane) {
return;
}

const r = this._heatmap._r;
const size = this.props.leaflet.map.getSize();

Expand Down