clauderic / clauderic/react-sortable-hoc
TypeError on element that renders null
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 959
- PR merge metrics
- No merged PRs in 30d
Description
I have a list with some elements that render null - depending on state. When I wrap them into a SortableElement it crashes with:
`
Uncaught TypeError: Cannot set property 'sortableInfo' of null
at WithSortableElement.register (react-sortable-hoc.esm.js:1541)
at WithSortableElement.componentDidMount (react-sortable-hoc.esm.js:1508)
at commitLifeCycles (react-dom.development.js:22101)
at commitLayoutEffects (react-dom.development.js:25344)
at HTMLUnknownElement.callCallback (react-dom.development.js:336)
at Object.invokeGuardedCallbackDev (react-dom.development.js:385)
at invokeGuardedCallback (react-dom.development.js:440)
at commitRootImpl (react-dom.development.js:25082)
at unstable_runWithPriority (scheduler.development.js:697)
at runWithPriority$2 (react-dom.development.js:12149)
`
Version: 1.11.0
As far as I can see it tries to find a DOM node - but there is none of course.
Is there anything I can do to avoid this problem?
I would like to keep the design at this point - elements becoming invisible depending on some state.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the register and componentDidMount paths in the react-sortable-hoc.esm.js stack trace, and reproduce the failure using a SortableElement whose rendered result is null. The work is done when this state no longer throws while sortable elements that render normally continue to behave as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100