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
Invariant Violation: Expected drag drop context find when deploy to server #1494
Comments
I upgraded my packages to the latest and the error occurs in my local environment. |
It’s because I have a ^ and I use yarn in local but npm in the cloud to build so I got different package version in local and dev. |
+1 I am getting this too Environment looks like:
|
This probably means you've got |
Did you solve this? I had the same issue and it turned out I had multiple react-dnd libraries of different versions being bundled in my app. Hopefully this helps someone. |
I am also facing the same issue. Did someone find the solution, please share. |
I wasn't exporting the |
you should wrap your test file component like so:
|
I really wish this info would be available on this page http://react-dnd.github.io/react-dnd/docs/overview. Otherwise users have to scroll through a whole implementation of the chess board to find this. |
I'm getting the
is definitely wrong. |
Thanks - this saved me a huge headache. Yeah, the documentation is definitely not accurate here. |
For me I fixed the issue by having the useDrop and associated div using the ref from that in its own component, as opposed to just inline JSX. I didn't change a single line of code - just generated the droppable div from its own component outside of the component wrapping it with DndProvider .. |
Hi. I also faced this issue. The solutions provided here directed me to the right path. I added it to very top of the component tree.
The imports --
|
Looks like this is the documentation page we're seeking; |
Had the same issue here. In my case, I was trying to add the droppable div to a library that was going to be consumed by another application, where the context would be defined. My solution was to move the react-dnd of the library to the devDependencies and as peerDependencie. |
Did you solve this? |
yes |
I've tried both suggestions in this thread -- wrapping my app at the most core, root level that I can, and wrapping it immediately above the component that's using DND. No matter what, I get this error. Any updates on the correct way to handle this? |
This solved the error for me |
I don't want to add the Dnd Provider any higher in your tree than necessary, since only a small portion of the app is actually using it. I solved it by wrapping sibling components in a fragment.
|
My app is working well on my local environment but when I deploy to the server, the console prints error: 'Invariant Violation: Expected drag drop context find' when deploying to the server.
I totally have no idea about what's wrong. Could you help give me some advice on what may be a root cause?
My local node version is 8.11.3. And I use 8.11.3 on the server to build and an express server to serve the static files under default cloud node environment (v6.7.0).
I am using:
"react-dnd": "^9.0.1"
"react-dnd-html5-backend": "^9.0.0"
"react-dnd-touch-backend": "^9.0.2"
The text was updated successfully, but these errors were encountered: