Only change card order if it has changed #31
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thesourceCard
. 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 😃