From 9a841136403b219e79c03528f2d70945fca3c44d Mon Sep 17 00:00:00 2001 From: liangzenan Date: Sat, 13 Jun 2020 14:55:18 +0800 Subject: [PATCH] fix: "Uncaught Invariant Violation: Expected to find a valid target." after cancelling a drag into the react sortable tree --- src/react-sortable-tree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/react-sortable-tree.js b/src/react-sortable-tree.js index b83e16a0..77e8fc26 100644 --- a/src/react-sortable-tree.js +++ b/src/react-sortable-tree.js @@ -230,7 +230,7 @@ class ReactSortableTree extends Component { // it means that the drag was canceled or the dragSource dropped // elsewhere, and we should reset the state of this tree if (!monitor.isDragging() && this.state.draggingTreeData) { - this.endDrag(); + setTimeout(() => {this.endDrag()}); } }