mcFrax / omicron-dnd

Fast JavaScript drag-and-drop library for desktop and mobile browsers.
MIT License
4 stars 0 forks source link

Error on missing children #8

Closed jan-warchol closed 2 years ago

jan-warchol commented 2 years ago

Describe the bug I got an error like this:

omicron-dnd.js?b658:1569 Uncaught TypeError: Cannot read properties of null (reading 'children')
    at getItemsInContainerEnd (omicron-dnd.js?b658:1569)
    at leaveContainer (omicron-dnd.js?b658:1276)
    at eval (omicron-dnd.js?b658:1222)

To Reproduce Put several cards with no children next to each other. Drag another card rapidly over drop zones of the childless cards. It seems that dragging over cards with subtasks don't result in this error.

Organizer commit: 1f97005c

mcFrax commented 2 years ago

The code is susceptible to a race when we have several pointerLeave events processed one after another, without a gap to execute leaveContainer() (which is scheduled with setTimeout). Then both leaveContainer() callbacks were called one after another, the first one setting toEl = null, and the second one running into this null.