Skip to content

"Uncaught Invariant Violation: Expected to find a valid target." after cancelling a drag into the react sortable tree #490

Open
@mx2323

Description

@mx2323

I 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.

Screen Shot 2019-05-31 at 1 12 04 PM

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions