Uncaught Invariant Violation: Expected an existing source.
paralin opened this issue · comments
Christian Stewart commented
I have a draggable component in my app within a react-window virtualized list:
const collect = useCallback(
(monitor: DragSourceMonitor) => ({ isDragging: monitor.isDragging() }),
[],
)
// setup the drag/drop drag source
const [{ isDragging }, drag] = useDrag({
item: handleDragStart,
type: MyDndItemType,
canDrag: !!onDragStart || selected,
// end: onDragEnd,
collect,
})
When the component is unmounted, this invariant is triggered:
I'm not doing anything special, just removing the component from the page.
How can I fix this error?