phphe / vue-draggable-nested-tree

Vue2 draggable tree component
https://hetree.phphe.com/
MIT License
345 stars 61 forks source link

"Uncaught TypeError: Cannot read property 'classList' of null" when dragging branch #73

Open rabbitfufu opened 5 years ago

rabbitfufu commented 5 years ago

Hello! Firstly, thank-you for taking the time to develop this component, it is much needed by the community.

I have noticed that the following error appears intermittently in Chrome Dev Tools while dragging a branch of the tree:

helper-js.es.js?3962:1237 Uncaught TypeError: Cannot read property 'classList' of null at hasClass (helper-js.es.js?3962:1237) at Object.targetPrevEl (vue-draggable-nested-tree.es.js?b1f6:1043) at eval (vue-draggable-nested-tree.es.js?b1f6:488) at Cache.remember (vue-draggable-nested-tree.es.js?b1f6:460) at Object.get (vue-draggable-nested-tree.es.js?b1f6:487) at Object.targetPrev (vue-draggable-nested-tree.es.js?b1f6:1050) at eval (vue-draggable-nested-tree.es.js?b1f6:488) at Cache.remember (vue-draggable-nested-tree.es.js?b1f6:460) at Object.get (vue-draggable-nested-tree.es.js?b1f6:487) at Object.appendPrev [as append prev] (vue-draggable-nested-tree.es.js?b1f6:641)

At first I thought it must be my own code. However I am actually able to reproduce this same error on the vue-draggable-nested-tree demo site.

It's difficult to describe exactly how to reproduce this. It seems to happen when dragging a node in a circular motion repeatedly overtop of other nodes, forcing the tree to reflow. The error happens fairly consistently when I do this.

Thanks (in advance) for your help!

phphe commented 5 years ago

I also got it. But it does not affect normal use.

rabbitfufu commented 5 years ago

One thing I have found that it does break is hot-reloading during development. After a bunch of those errors occur, changes to the code are no longer hot-reloaded, and instead require a refresh.

It would be best if the script does not spill out errors during normal use.