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.

Including react-querybuilder in a drag-n-drop application causes errors of "Cannot have two HTML5 backends at the same time."

See original GitHub issue

Hello,

We are trying to use react-querybuilder in a React application that also uses Drag-N-Drop (via react-dnd).

Unfortunately, including react-querybuilder causes an infinite loop of errors of Cannot have two HTML5 backends at the same time.. We have attempted a workaround of overriding the rootElement of our application’s DndProvider, but that seems to break drag-n-drop into react-querybuilder from the application.

A potential fix for this issue is the approach taken by react-sortable-tree, where the library exports the component as SortableTreeWithoutDndContext, relying on the application to create a DndProvider: https://github.com/frontend-collective/react-sortable-tree/blob/master/src/react-sortable-tree.js#L960

If necessary, I can try to create a diff with the changes that replicate the above fix.

Thank you! Kyrylo Stepanchuk

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kyrylostepanchukcommented, Feb 3, 2022

@jakeboone02 I just tested the latest 4.2.0 version with our application, and it seems to have worked. Many thanks! One last piece that was missing was involving our own webpack configuration. It may be due to the way dependencies are pulled in by npm (react-querybuilder would have its own copy). This was the fix:

react-dnd/react-dnd#3349

Our webpack config had to include this section to import all react-dnd code from the same place.

resolve: {
  alias: {
    'react-dnd': path.resolve('node_modules/react-dnd')
  }
},

Just FYI, in case it comes up for someone else.

1reaction
jakeboone02commented, Jan 31, 2022

@kyrylostepanchuk I implemented your suggested fix in #282 (also, I hope you don’t mind, I marked the commit as co-authored by you – I can undo that if you want).

Can you fork this codesandbox (it uses the new code), try to recreate the scenario and see if the problem is resolved?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot have two HTML5 backends at the same time #3178
Describe the bug I use different react-table draggable in different react-tabs My Index.js contains: import { HTML5Backend } from ...
Read more >
React DnD - "Cannot have two HTML5 backends at the same ...
The purpose is to make an app like trello but for an recruitment process. My front is in ReactJS. I have 3 components,...
Read more >
<QueryBuilder /> | React Query Builder
Props and other configuration for the main component. ... you will probably see the error message "Cannot have two HTML5 backends at the...
Read more >
CHANGELOG.md | react_querybuilder@v5.1.3 - Deno
#301 react-querybuilder and the compatibility packages are all built with React ... an error would appear: "Cannot have two HTML5 backends at the...
Read more >
"Cannot have two HTML5 backends at the same time."-Reactjs
to the topmost react component. Structure before: App Component1 Component2 ... ComponentX with render(<DragDropContextProvider>...<DragDropContextProvider>).
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