Skip to content

Commit 570b8fd

Browse files
committed
Destroy the sortable instance at componentWillUnmount
1 parent 7d25b56 commit 570b8fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module.exports = class extends React.Component {
3333
options: {},
3434
tag: 'div'
3535
};
36-
3736
sortable = null;
3837

3938
componentDidMount() {
@@ -84,6 +83,12 @@ module.exports = class extends React.Component {
8483

8584
this.sortable = Sortable.create(ReactDOM.findDOMNode(this), options);
8685
}
86+
componentWillUnmount() {
87+
if (this.sortable) {
88+
this.sortable.destroy();
89+
this.sortable = null;
90+
}
91+
}
8792
render() {
8893
const { children, className, tag } = this.props;
8994
return React.DOM[tag]({ className }, children);

0 commit comments

Comments
 (0)