Skip to content

DndProvider (new Api) cause Invariant Violation in production #105

@Elendiar

Description

@Elendiar
"react": "^18.2.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dnd-multi-backend": "^8.0.0",
"rdndmb-html5-to-touch": "^8.0.0",

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 error

import { DndProvider } from 'react-dnd'

 <DndProvider backend={MultiBackend} options={HTML5toTouch}>
...

This happens when i explicitly set react-dnd-html5-backend in package.json with updated yarn to 3.6.0 (because there is import { getEmptyImage } from "react-dnd-html5-backend"; in code.)

Before this DndProvider from 'react-dnd-multi-backend' worked without this error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions