Skip to content

Commit 15ff005

Browse files
author
Claudéric Demers
authored
Merge pull request clauderic#66 from krisl/changable-collection
Support changing an item's collection prop on the fly
2 parents 2a737fe + f090117 commit 15ff005

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/SortableElement/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export default function SortableElement (WrappedComponent, config = {withRef: fa
4141
this.setDraggable(collection, index);
4242
}
4343
}
44+
else if (this.props.collection !== nextProps.collection) {
45+
this.removeDraggable(this.props.collection);
46+
this.setDraggable(nextProps.collection, nextProps.index);
47+
}
4448
}
4549
componentWillUnmount() {
4650
let {collection, disabled} = this.props;

0 commit comments

Comments
 (0)