clauderic / clauderic/react-sortable-hoc

When using the distance prop on a SortableContainer in a nested component an error is thrown

Open
#130 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

When using the distance property on a nested SortableContainer an exception is thrown because the active property on the manager is undefined. There is a function called getActive on the Manager class and if you do a check for the active property the error appears to be fixed.
```javascript
getActive() {
if(!this.active)
return null;

return find(this.refs[this.active.collection], ({node}) => node.sortableInfo.index == this.active.index);
}
```

I am unsure of the specifics of the library so do not really feel confident in issuing a pull request for this there is probably a more elegant fix. This error only occurs when using the distance property though.

Sandy.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Manager class and its getActive() method, then reproduce a nested SortableContainer using the distance property. Confirm the active-manager state that triggers the exception and verify that the scenario no longer throws without breaking active-item lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.