Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Invariant Violation: Expected an existing source. #3610

Open
paralin opened this issue Dec 23, 2023 · 0 comments
Open

Uncaught Invariant Violation: Expected an existing source. #3610

paralin opened this issue Dec 23, 2023 · 0 comments

Comments

@paralin
Copy link

paralin commented Dec 23, 2023

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:

invariant(this.getSource(sourceId), 'Expected an existing source.')

I'm not doing anything special, just removing the component from the page.

How can I fix this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant