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 targetids to be registered after dragging too fast #3403

Open
takeandrei5 opened this issue Mar 8, 2022 · 2 comments

Comments

@takeandrei5
Copy link

Hello!

We implemented a two column list using the react hooks and hover functionality. The functionality works great and there are no issues if we move the items inside the same list (reordering) or if we drag the items between the two lists in a normal manner. However, when we try to drag the items between the two lists as fast as we can, we randomly get this error. We looked into all the other topics which we could find but to no avail.

Any ideas?

  • OS: Windows
  • Browser Chrome
  • Version 98.0.4758.102

We are running the latest version of react-dnd. v15.11

@RobinKamps
Copy link

Same here. Unfortunately after the error occures the drag preview gets very laggy, so its hard to just ignore the error. Seems to be the same as #763.

@Youmyin
Copy link

Youmyin commented Mar 28, 2022

I tried to change to the latest version 15.1.1, but it still doesn't work. Surprisingly, this error only exists in the local development environment and disappears after deploying to the server, so how can i fix it?

darthtrevino added a commit that referenced this issue Mar 29, 2022
* fix: "Invariant Violation: Expected targetIds to be registered."

We've sporadically seen this error from customers. The call stack
indicates that it's originating from HTML5BackendImpl's
handleTopDragOver's requestAnimationFrame callback.  I've been unable to
reproduce it locally; however, if I simulate a slowdown by replacing
`requestAnimationFrame(callback)` with `setTimeout(callback, 10000)`, I
can fairly reliably reproduce this error.

To fix it, I believe HTML5BackendImpl should consistently clear the
hover animation whenever the drag operation is ended for any reason.

I locally tested this fix in the v15.1.2 tag, and it appeared to work.

Fixes #763, #3403

* chore: semver

* fix: cancel any raf before creating a new one

Co-authored-by: Chris Trevino <chtrevin@microsoft.com>
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

3 participants