Skip to content

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

@leqwasd

Description

@leqwasd

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions