react-dnd / react-dnd-html5-backend

HTML5 backend for React DnD [Legacy Repo]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught Invariant Violation: Only a ReactOwner can have refs

hiattp opened this issue · comments

commented

I'm sticking close to the documentation and everything seems to work except for this console error:

Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

I double-checked that I don't have more than one version of React running, and the error only pops up when I wrap my component with the DragDropContext. Oddly this issue doesn't seem to affect the drag and drop functionality, but as soon as that error is thrown it breaks the router (react-router@2.6.1 and react-router-redux@4.0.5) and my store changes stop propagating.

Is there something about using React Router/Redux that causes issues with with the DnD backends/context?

Hunting around led to only one other (apparently unsolved) reference to the same issue by @blittle here. I'm using React version 15.3.1.

Not sure if this is more appropriate in https://github.com/gaearon/react-dnd/issues but figured I'd start here. Thanks!

commented

Closing until I'm able to reproduce in https://github.com/lockstep/redux-dnd.

commented

False alarm, this was caused by a rogue node_modules directory left over from some refactoring that was somehow polluting the bundle.

I have been stuck on what sounds like the same issue for a long time now. @hiattp, when you used ls inside of your project repo could you see the duplicate node_modules folder? I have blown away that directory and rebuild many times now. Thanks, any help is greatly appreciated

commented

If I recall correctly the problematic node_modules folder was in a subdirectory or something trickier than just the root node_modules directory. Can't remember exactly though been a while :/

@hiattp thanks for your help!