"Uncaught Invariant Violation: Expected to find a valid target." after cancelling a drag into the react sortable tree
See original GitHub issueI discovered this issue while integrating react-sortable-tree into my app, but was able to easily reproduce with one of the examples in the storybook.
https://codesandbox.io/s/xzoq6xprlz
Drag the “baby rabbit” box to the React Sortable Tree area, move it around so that it registers with the React Sortable Tree, then move the box out of the React Sortable Tree area such that the placeholder turns red, then release the box outside of the React Sortable Tree area.
This will cause the Console to fire with this error.
**browser.js:38 Uncaught Invariant Violation: Expected to find a valid target.
at invariant (https://xzoq6xprlz.codesandbox.io/node_modules/invariant/browser.js:38:15)
at DragDropMonitorImpl.canDropOnTarget (https://xzoq6xprlz.codesandbox.io/node_modules/dnd-core/lib/cjs/DragDropMonitorImpl.js:67:9)**
at DropTargetMonitorImpl.canDrop (https://xzoq6xprlz.codesandbox.io/node_modules/react-dnd/lib/cjs/DropTargetMonitorImpl.js:24:41)
at nodeDropTargetPropInjection (https://xzoq6xprlz.codesandbox.io/node_modules/react-sortable-tree/dist/index.cjs.js:2367:28)
at DragDropContainer.getCurrentState (https://xzoq6xprlz.codesandbox.io/node_modules/react-dnd/lib/cjs/decorateHandler.js:116:29)
at DragDropContainer._this.handleChange (https://xzoq6xprlz.codesandbox.io/node_modules/react-dnd/lib/cjs/decorateHandler.js:45:39)
at handleChange (https://xzoq6xprlz.codesandbox.io/node_modules/dnd-core/lib/cjs/DragDropMonitorImpl.js:27:21)
at dispatch (https://xzoq6xprlz.codesandbox.io/node_modules/redux/lib/redux.js:220:7)
at Object.eval [as endDrag] (https://xzoq6xprlz.codesandbox.io/node_modules/dnd-core/lib/cjs/DragDropManagerImpl.js:67:21)
at HTML5Backend.handleTopDragEndCapture (https://xzoq6xprlz.codesandbox.io/node_modules/react-dnd-html5-backend/lib/cjs/HTML5Backend.js:145:31)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:16 (1 by maintainers)
Top Results From Across the Web
"Uncaught Invariant Violation: Expected to find a valid target ...
"Uncaught Invariant Violation: Expected to find a valid target." after cancelling a drag into the react sortable tree.
Read more >React DnD Expected to find a valid target - Stack Overflow
In order to trigger the error just drag & drop the first item into another one. Notice that if you drag & drop...
Read more >React Dnd Expected To Find A Valid Target - ADocLib
Uncaught Error: Invariant Violation: Expected to find a valid target.n ... to find a valid target. after cancelling a drag into the react...
Read more >cuong-react-sortable-tree - npm
... react-sortable-tree to fixed error: "Uncaught Invariant Violation: Expected to find a valid target." A React component for Drag-and-drop ...
Read more >How to implement drag and drop in React with React DnD
It will automatically require the dropzone to allow only one file to get accepted. isDragActive is set if the files are dragged above...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 Also getting this
+1