Skip to content

Commit dbe30f5

Browse files
committed
Remove initialStart state.
Causes problems when you intend to move an item back to its starting position and doesn't actually accomplish its intended optimization goal.
1 parent f75fb5a commit dbe30f5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/draggable.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,7 @@ module.exports = React.createClass({
483483

484484
componentWillReceiveProps: function(newProps) {
485485
// React to changes in the 'start' param.
486-
if (newProps.moveOnStartChange && newProps.start &&
487-
(newProps.start.x !== this.state.initialStart.x || newProps.start.y !== this.state.initialStart.y)) {
486+
if (newProps.moveOnStartChange && newProps.start) {
488487
this.setState(this.getInitialState(newProps));
489488
}
490489
},
@@ -525,9 +524,7 @@ module.exports = React.createClass({
525524
offsetX: 0, offsetY: 0,
526525

527526
// Current transform x and y.
528-
clientX: props.start.x, clientY: props.start.y,
529-
530-
initialStart: props.start
527+
clientX: props.start.x, clientY: props.start.y
531528
};
532529
},
533530

0 commit comments

Comments
 (0)