-
-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Description
Describe the bug
Drag and drop node in tree above top most node will make runtime crash:
429.38ab39ad.iframe.bundle.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'item')
at getHoveringPosition (main.61823e9c.iframe.bundle.js:2:352027)
at Object.current (main.61823e9c.iframe.bundle.js:2:352284)
at Object.onDragOverTreeHandler (main.61823e9c.iframe.bundle.js:2:546327)
at onDragOver (main.61823e9c.iframe.bundle.js:2:451668)
at Object.Nb (429.38ab39ad.iframe.bundle.js:2:1710399)
at Tb (429.38ab39ad.iframe.bundle.js:2:1710553)
at Ub (429.38ab39ad.iframe.bundle.js:2:1730480)
at nf (429.38ab39ad.iframe.bundle.js:2:1730574)
at se (429.38ab39ad.iframe.bundle.js:2:1730988)
at 429.38ab39ad.iframe.bundle.js:2:1736474
To Reproduce
Single Tree Example . Easy to reproduce when click Zoom Out once time in Storybook then drag and drop node in tree above top most node and move around mouse. Sometime Zoom Out not needed.
Expected behavior
No crash
Desktop (please complete the following information):
- OS: [Windows, Linux, Mac]
- Browser [chrome]
- Version [108.0]
Additional context
Crash happen in getHoveringPosition()
hoveringPosition can be negative when clientY less then treeTop, it make linearIndex negative and make crash on line 38.
Maybe fix on line 26?
const linearIndex = Math.max(0, Math.floor(hoveringPosition));
Metadata
Metadata
Assignees
Labels
No labels