question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using SortableTreeWithoutDndContext does not work

See original GitHub issue

rstwithoutdndcontext

There are two DnDs in a page. One for the RST with external nodes, and the other for the tab swapping. We place <DndProvider /> in top level component and use SortableTreeWithoutDndContext in child component to avoid two HTML backends issue.

It seems the RST renders nothing or returns null as the dragDropManager is undefined. https://github.com/frontend-collective/react-sortable-tree/blob/2a5f741d0bc965b47a8ea6764e98a13aa3e51544/src/react-sortable-tree.js#L941-L949

Is there a workaround to deal with this issue? Thank You.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

4reactions
drewpccommented, Oct 16, 2020

@zourbuth I had the same problem and it was because I ended up with two copies of react-dnd in my final Webpack bundle, one that I was importing and the other that react-sortable-tree imported. Because DndContext is a singleton, having two copies means there are two singletons! I resolved the issue for myself by ensuring Webpack resolved the react-dnd package to a single, top-level installation of react-dnd.

https://webpack.js.org/configuration/resolve/#resolvealias

3reactions
Nausscommented, Oct 28, 2020

I was having the same problem for months now and none of the solutions worked except for @drewpc 's one https://github.com/frontend-collective/react-sortable-tree/issues/788#issuecomment-710661403 ! Thanks 😃

If anyone is interested, my webpack modification looks like this:

  resolve: {
    ...
    alias: {
      'react-dnd': path.resolve(__dirname, '../node_modules/react-dnd'),
    },
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Check the render method of `DragDropContext ...
I am trying to use the react-sortable-tree module in my project, but I have been having issues with importing the component into my ......
Read more >
react-sortable-tree-patch-react-17 - npm
Troubleshooting. If it throws "TypeError: fn is not a function" errors in production. This issue may be related to an ongoing incompatibility ...
Read more >
react-sortable-tree | Yarn - Package Manager
Works? Chrome, Yes. Firefox, Yes. Safari, Yes. IE 11, Yes. Troubleshooting. If it throws "TypeError: fn is not a function ...
Read more >
pearson-react-sortable-tree/README.md - UNPKG
If not set explicitly, a default value is applied by react-sortable-tree for you ... Defaults to a function that uses the `searchQuery` string...
Read more >
React-sortable-tree-modified - npm.io
https://github.com/Hovakimyan/React-Sortable-Tree-Modified/issues/6) | ## Troubleshooting ### If it doesn't work with other components that use react-dnd ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found