Skip to content

Commit 81dc291

Browse files
author
Claudéric Demers
authored
Move handleSort callback invocation after setState (clauderic#82)
1 parent 2c60c11 commit 81dc291

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/SortableContainer/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,6 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
308308
el.style[`${vendorPrefix}TransitionDuration`] = '';
309309
}
310310

311-
if (typeof onSortEnd === 'function') {
312-
onSortEnd({
313-
oldIndex: this.index,
314-
newIndex: this.newIndex,
315-
collection
316-
}, e);
317-
}
318-
319311
// Stop autoscroll
320312
clearInterval(this.autoscrollInterval);
321313
this.autoscrollInterval = null;
@@ -327,6 +319,14 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
327319
sorting: false,
328320
sortingIndex: null
329321
});
322+
323+
if (typeof onSortEnd === 'function') {
324+
onSortEnd({
325+
oldIndex: this.index,
326+
newIndex: this.newIndex,
327+
collection
328+
}, e);
329+
}
330330

331331
this._touched = false;
332332
}

0 commit comments

Comments
 (0)