react-sortablejs
react-sortablejs copied to clipboard
[bug] × TypeError: Cannot read property 'props' of null
Describe the bug TypeError: Cannot read property 'props' of null
To Reproduce Steps to reproduce the behavior: This issue is intermittent but very frequent for me now. This happens in all cases sometimes (whether I re-arrange the items inside the list or nested list or I move some element from parent list to inner list and vice-versa.
Expected behavior The root cause is very hard to find as it is intermittent but the expectation is that the basic needs should be fulfilled for which this library is made. It can not crash after item gets dropped inside the list.
Information I am using this along with react-dnd(9.3.4) i.e. my parent list(canvas) will not have pre-populated items. The canvas will get items by dragging the item from side section in the page. Therefore, the root div of canvas is accepting all those items from side section with the help of react-dnd useDrop feature. Similarly, for my nested list (which is one of the items that got dragged from side section and put inside the canvas), the child items are being dragged too from side section and the root div of the nested list also accepts those items with the help of react-dnd useDrop feature.
Versions - react-sortablejs = 6.0.0 sortablejs = 1.12.0 react = 16.13.1
Additional context
this is happening for me because I don't have an element directly after the .map
this.state.items.map(item => item.status === "active" ?<div key={blah}></div>:null)
as soon as I commented out that status check, it started working. Maybe a ref would work but it looks like that may still be a TODO item: https://github.com/SortableJS/react-sortablejs#custom-component
thanks, @switch13, worked for me!
I am not working on this now but closing this as the solution given by @switch13 has solved @rhythm-sharma's issue. Please feel free to comment to re-open this issue if the problem still persists.