Skip to content

Commit f21ed7f

Browse files
trend-edward-shihultralabed
authored andcommitted
Fix failed to execute 'removeChild' on 'Node', #55
1 parent 114a664 commit f21ed7f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Sortable.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ class Sortable extends Component {
8686
this.sortable = SortableJS.create(this.node, options);
8787
}
8888

89+
shouldComponentUpdate(nextProps) {
90+
// If onChange is null, it is an UnControlled component
91+
// Don't let React re-render it by setting return to false
92+
if (!nextProps.onChange) {
93+
return false;
94+
}
95+
return true;
96+
}
97+
8998
componentWillUnmount() {
9099
if (this.sortable) {
91100
this.sortable.destroy();

0 commit comments

Comments
 (0)