SortableJS/react-sortablejs

Cannot read properties of null (reading 'props'), found the issue

leqwasd opened this issue · 0 comments

I think I found an issue with one condition here:

if (child === undefined) return undefined;

My render looks like this (psudo)

interface Data {
  columns: string[];
  optionalColumns?: string[];
}
[..]
return (
  <ReactSortable ...>
    {optionalColumns?.map(x => <Item x={x} />)}
    {columns.map(x => <Item x={x} />)}
  </ReactSortable>
)

It fails for me on line:

const { className: prevClassName } = child.props;

Because the guard at line 121 does not handle this...

null === undefined // false

Shouldn't there be just child == null ? Double eq with null, which will handle nulls and undefineds?