Skip to content
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

DragDropContext HMLT5Backend at top level of my app #31

Open
khelkun opened this issue Sep 18, 2017 · 6 comments
Open

DragDropContext HMLT5Backend at top level of my app #31

khelkun opened this issue Sep 18, 2017 · 6 comments

Comments

@khelkun
Copy link
Contributor

khelkun commented Sep 18, 2017

Dazzle wraps its Dashboard Component with react-dnd's DragDropContext(HMLT5Backend)

I wish to use Dazzle in my application but also use react-dnd in another part of my component hierarchy which is not under the Dashboard component of Dazzle. So I would need to wrap my top most component in my React application with DragDropContext(HMLT5Backend). But whatever I do I will get the "Error: Cannot have two HTML5 backends at the same time" from react-dnd.

I think I'll not be able to do this without modifying Dazzle to not instantiate the DragDropContext in the Dashboard component. Am I right or is there a workaround that would not imply to modify Dazzle?

@Raathigesh
Copy link
Owner

I'm afraid there is no workaround I can think of right now since dazzle is coupled with react-dnd. Sorry about that!

@khelkun
Copy link
Contributor Author

khelkun commented Sep 18, 2017

For my usage I declared a new component in dazzle called DashboardNoDndContext (that doesn't instantiate the DragDropContext) and rebuilt and it seems to be enough for my need. Obviously I also exported this DashboardNoDndContext in the index.js (not default export).
I can do a pull request for that: exporting a second Dashboard component that let the responsability of creating the DragDropContext to the user of Dazzle. What do you think ? (I'm also not sure how to call this alternate Dashboard component)

@Raathigesh
Copy link
Owner

That seems like a neat solution! Feel free to send a PR! how about DashboardWithoutDndContext ?

@khelkun
Copy link
Contributor Author

khelkun commented Sep 18, 2017

Thanks I'll go for this PR
Ok for the component name. I'll see if I can just keep one Dashboard component definition and export 2 distinct symbols for the same module: one wrapped/decorated by DragDropContext and the other without this wrapping.

@Raathigesh
Copy link
Owner

Raathigesh commented Sep 18, 2017

Awesome! Two exports from the same file would be nice. We could remove the decorator and have an export which wraps the dashboard component with the Dnd context as you mentioned above.

@armckenzie
Copy link

Hello, is any timeline for a release that will include this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants