Skip to content

Commit

Permalink
Merge pull request clauderic#66 from krisl/changable-collection
Browse files Browse the repository at this point in the history
Support changing an item's collection prop on the fly
  • Loading branch information
Claudéric Demers authored Oct 18, 2016
2 parents 2a737fe + f090117 commit 15ff005
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/SortableElement/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export default function SortableElement (WrappedComponent, config = {withRef: fa
this.setDraggable(collection, index);
}
}
else if (this.props.collection !== nextProps.collection) {
this.removeDraggable(this.props.collection);
this.setDraggable(nextProps.collection, nextProps.index);
}
}
componentWillUnmount() {
let {collection, disabled} = this.props;
Expand Down

0 comments on commit 15ff005

Please sign in to comment.