react-dnd icon indicating copy to clipboard operation
react-dnd copied to clipboard

Material UI Data Grid - Uncaught Invariant Violation: Cannot call hover while not dragging.

Open jmyager-prg opened this issue 3 years ago • 6 comments

Describe the bug Dragging and reordering a column header in Material UI's Data Grid component throws error in react-dnd. This only seems to occur when useDrop hook is being used.

Reproduction

Live Reproduction

Steps to reproduce the behavior:

  1. Go to 'codesandbox'
  2. Click on a column header in the MUI table and drag to reorder
  3. See error

Expected behavior Material UI Data Grid columns should be able to be dragged, dropped, and reordered without error.

Screenshots Screen Shot 2022-08-25 at 9 29 10 AM

Desktop (please complete the following information):

  • OS: MacOS Monterey 12.5.1
  • Browser: Chrome Version
  • Version: 104.0.5112.79 (Official Build) (x86_64)

Additional context Add any other context about the problem here.

jmyager-prg avatar Aug 25 '22 13:08 jmyager-prg

Got same issue, solved by adding canDrag, collect: (monitor) => ({ opacity: monitor.isDragging() ? 0 : 1, isDragging: !!monitor.getItem() })

to useDrag hook. credit: https://dev.to/danielbellmas/dragging-over-an-element-without-triggers-hover-state-1ggh

joaoalbertocsjunior avatar Oct 04 '23 07:10 joaoalbertocsjunior

The OP's question is about MaterialUI's DataGrid component. Have you found a solution when using that?

agoodisman avatar Oct 13 '23 21:10 agoodisman

The OP's question is about MaterialUI's DataGrid component. Have you found a solution when using that?

Was trying to use it along with debouce from lodash, remove it or any delay functions and it will work without throwing the error, z's

edit: else you will need to make your own implementation to handle it

joaoalbertocsjunior avatar Oct 14 '23 07:10 joaoalbertocsjunior

any updates?

andrewtsybulia avatar Feb 10 '24 15:02 andrewtsybulia