dnd-multi-backend: TypeError: manager.getActions is not a function with latest react-dnd version (9.3.2 at time of writing)

Reproduction: https://codesandbox.io/s/react-dnd-example-11-ow923

Potentially related to the removal of DragDropContext (replaced by DndProvider)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 19 (9 by maintainers)

Most upvoted comments

I completely forgot to link that, my bad: https://github.com/LouisBrunner/dnd-multi-backend/tree/next/packages/react-dnd-multi-backend#migrating-from-3xx

react-dnd 9.x.x introduces DnDProvider which creates the backend and provides arguments (context, manager and extra args), thus the previous syntax of calling TouchBackend with arguments and passing it to react-dnd doesn’t work anymore.

You will have to transform your pipeline from

...
    {
      backend: TouchBackend({ enableMouseEvents: true }), // Note that you can call your backends with options
      preview: false,
      transition: TouchTransition
    }
...

to

...
    {
      backend: TouchBackend,
      options: {enableMouseEvents: true}, // Note that you can call your backends with options
      preview: false,
      transition: TouchTransition
    }
...

Just to keep you up to date, I am preparing a new version (probably 4.0.0) on the next branch that will fix this issue by supporting the new >= 9.0.0 react-dnd API.

However react-dnd non-esm builds are completely broken (wrong entry point, wrong imports…) so it will have to wait until that is fixed. In the meantime, I will update 3.x.x to forbid usage of newer react-dnd.

@chuckdries Thanks for the report, I will take a look as soon as possible!

As it seems like this issue is now fixed by 4.0.0-0, I will publish it on latest as 4.0.0, thanks to all of you for your patience!

Hi,

EDIT: nevermind that was some npm bug, I just restarted it and it works perfectly.

I had the same problem, so I installed all the dependencies :

    "dnd-core-cjs": "^9.4.0",
    "node-sass": "^4.12.0",
    "react": "^16.8.6",
    "react-dnd": "^9.4.0",
    "react-dnd-cjs": "^9.4.0",
    "react-dnd-html5-backend": "^9.4.0",
    "react-dnd-html5-backend-cjs": "^9.4.0",
    "react-dnd-multi-backend": "^4.0.0-0",
    "react-dnd-touch-backend": "^9.4.0",
    "react-dnd-touch-backend-cjs": "^9.4.0",
    "react-dom": "^16.8.6",
    "react-redux": "^7.1.1",
    "react-router-dom": "^5.0.1",
    "react-scripts": "3.0.1",
    "redux": "^4.0.4",
    "redux-thunk": "^2.3.0",
    "tmp": "^0.1.0"

used the same import and custom pipeline as above but with preview: true and the same DndProvider.

Then this error appeared :

Error: You must specify at least one Backend, if you are coming from 2.x.x (or don't understand this error)
        see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-2xx

Could you help me understand why ? Thank you

The next branch is currently using the CommonJS version of react-dnd, thus you will need to use react-dnd-cjs, dnd-core-cjs, react-dnd-html5-backend-cjs and react-dnd-touch-backend-cjs in your dependencies for now (see peerDependencies of react-dnd-multi-backend and react-dnd-preview).