clauderic / clauderic/react-sortable-hoc
Getting undefined for collection from onSortStart
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 959
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
When `onSortStart` triggers, I am getting `undefined` for the property `collection`. But I get the expected `collection` when `onSortEnd` triggers. I am passing the collection to the SortableElement that I have created, as it states in the docs.
Looking at the code the way that the `collection` is grabbed is different from [`onSortStart`](https://github.com/clauderic/react-sortable-hoc/blob/v0.8.2/src/SortableContainer/index.js#L256) and [`onSortEnd`](https://github.com/clauderic/react-sortable-hoc/blob/v0.8.2/src/SortableContainer/index.js#L391). Meaning, you are grabbing `active` from `this.manager.active` in `onSortEnd`, because it gets set [here](https://github.com/clauderic/react-sortable-hoc/blob/v0.8.2/src/SortableContainer/index.js#L179). And in `onSortStart` your grabbing `active` from [`this.manager.getActive()`](https://github.com/clauderic/react-sortable-hoc/blob/v0.8.2/src/SortableContainer/index.js#L245).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/SortableContainer/index.js at the onSortStart and onSortEnd handlers, comparing their active-item lookup with the assignment around line 179. Reproduce the callback behavior and verify that onSortStart exposes the same collection value as onSortEnd.
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
- Clearly specified
- Newbie friendliness
- 48/100