Skip to content

Commit

Permalink
Move handleSort callback invocation after setState (clauderic#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudéric Demers authored Jan 26, 2017
1 parent 34d5e36 commit 0e356ae
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/SortableContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,6 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
el.style[`${vendorPrefix}TransitionDuration`] = '';
}

if (typeof onSortEnd === 'function') {
onSortEnd({
oldIndex: this.index,
newIndex: this.newIndex,
collection
}, e);
}

// Stop autoscroll
clearInterval(this.autoscrollInterval);
this.autoscrollInterval = null;
Expand All @@ -327,6 +319,14 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
sorting: false,
sortingIndex: null
});

if (typeof onSortEnd === 'function') {
onSortEnd({
oldIndex: this.index,
newIndex: this.newIndex,
collection
}, e);
}

this._touched = false;
}
Expand Down

0 comments on commit 0e356ae

Please sign in to comment.