Skip to content

Commit f11b37d

Browse files
committed
Prevent invariant if unmounted while dragging.
1 parent 94c4f43 commit f11b37d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Draggable.es6

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ export default class Draggable extends DraggableCore {
139139
}
140140
}
141141

142+
componentWillUnmount() {
143+
this.setState({dragging: false}); // prevents invariant if unmounted while dragging
144+
}
145+
142146
onDragStart = (e, coreEvent) => {
143147
log('Draggable: onDragStart: %j', coreEvent.position);
144148

0 commit comments

Comments
 (0)