Skip to content

Commit f8936f5

Browse files
authored
fix possible memory leak in ColumnResizer (#82)
1 parent e3a803a commit f8936f5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## NEXT VERSION
44

5+
- fix: fix possible memory leak in `ColumnResizer`
6+
57
## v1.7.2 (2019-08-26)
68

79
- fix: custom renderers should support function component with hooks

src/ColumnResizer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class ColumnResizer extends React.PureComponent {
5151
this._handleMouseMove = this._handleMouseMove.bind(this);
5252
}
5353

54-
componentWillMount() {
54+
componentWillUnmount() {
5555
if (this.handleRef) {
5656
const { ownerDocument } = this.handleRef;
5757
ownerDocument.removeEventListener('mousemove', this._handleMouseMove);
58-
ownerDocument.addEventListener('mouseup', this._handleMouseUp);
58+
ownerDocument.removeEventListener('mouseup', this._handleMouseUp);
5959
removeUserSelectStyles(ownerDocument);
6060
}
6161
}

0 commit comments

Comments
 (0)