-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
DndProvider (new Api) cause Invariant Violation in production #105
Comments
You can reproduce this by creating a yarn monorepo (workspaces) with one app inside and install the following:
The problem is that This force somehow yarn to install
And because Currently the only fix i found is to change the import path of import { useDrag, useDrop } from 'react-dnd-multi-backend/../react-dnd'; I think that properly define |
@moshest Thanks for adding more details to this but unfortunately this isn't enough for me to be able to reproduce the issue (I tried). Could you link to some demo repository I could build and try? |
I was able to reproduce it using the following setup:
{
"name": "dnd-bug",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"workspaces": [
"apps/*"
],
"devDependencies": {
"@types/node": "20.4.4",
"@types/react": "18.2.16",
"@types/react-dom": "18.2.7"
}
}
{
"name": "my-app",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"dependencies": {
"@types/node": "20.4.4",
"@types/react": "18.2.18",
"@types/react-dom": "18.2.7",
"react": "18.2.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dnd-multi-backend": "^8.0.1",
"react-dnd-touch-backend": "^16.0.1",
"react-dom": "18.2.0"
}
} Notice that Syncing both versions of |
If the issue is with conflicting versions of |
I'm not an expert on Yarn/NPM, but I think using a dependency package should be mention on the package definition. Maybe not mentioning that There is a reason it's not listed on the |
I released |
I met with strange behavior, in the dev environment everything works with the new api, but in production there is an error
Invariant Violation: Expected drag drop context
.This happens with DndProvider (new API) usage only
<DndProvider options={HTML5toTouch}>
, but old one doesn't throw this errorThis happens when i explicitly set
react-dnd-html5-backend
in package.json with updated yarn to 3.6.0 (because there isimport { getEmptyImage } from "react-dnd-html5-backend";
in code.)Before this
DndProvider from 'react-dnd-multi-backend'
worked without this errorThe text was updated successfully, but these errors were encountered: