Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only change card order if it has changed #31

Merged
merged 1 commit into from
May 31, 2016

Conversation

chrislaskey
Copy link
Contributor

When working on #30 I noticed an issue when then a card is dragged and dropped back in its original location. This pull request fixes it.

Previously picking up a card and dropping it in the same spot would cause the card to swap positions with the card below it. Now the card stays in its current position and does not dispatch an update event to the phoenix backend.

The logic here is pretty simple - check to see if the targetCard is the same as the card that is currently below the sourceCard. If it is, return early and don't update the position.

The behavior when dragging a card to a different location within the same list, or dragging to another list remains the same.

Definitely open to suggestions for improvement. Was having a hard time coming up with a meaningful variable name.

Thanks again for this project, it's been really fun reading through the code and learning 😃

Fixes an issue when then a card is dragged and dropped back in its original location.

Previously this would cause the card to swap positions with the card below it.

Now the card stays in its current position and does not dispatch an update event to the phoenix backend.

The behavior when dragging to a different location within the same list, or dragging to another list remains the same.
@bigardone bigardone merged commit 8c1118a into bigardone:master May 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants