diff --git a/lib/Draggable.js b/lib/Draggable.js index e42b47bb..f9384d9d 100644 --- a/lib/Draggable.js +++ b/lib/Draggable.js @@ -236,7 +236,9 @@ class Draggable extends React.Component { } componentWillUnmount() { - this.setState({dragging: false}); // prevents invariant if unmounted while dragging + if (this.state.dragging) { + this.setState({dragging: false}); // prevents invariant if unmounted while dragging + } } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find diff --git a/lib/DraggableCore.js b/lib/DraggableCore.js index c5a3da8f..85ed3137 100644 --- a/lib/DraggableCore.js +++ b/lib/DraggableCore.js @@ -258,7 +258,16 @@ export default class DraggableCore extends React.Component { + removeUserSelectStyles(ownerDocument); + }); + } else { + removeUserSelectStyles(ownerDocument); + } + } } }