Skip to content

Commit

Permalink
fix: XY sorting bug when n=1
Browse files Browse the repository at this point in the history
When sorting between lists, and the destination had only 1 item, it threw an error trying to animate nodes because `nextNode ` was undefined.
  • Loading branch information
Jexordexan committed Feb 17, 2021
1 parent d8e9adf commit 819bd4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ContainerMixin.js
Expand Up @@ -657,7 +657,7 @@ export const ContainerMixin = {
// If the current node is to the left on the same row, or above the node that's being dragged
// then move it to the right
translate.x = this.width + this.marginOffset.x;
if (edgeOffset.left + translate.x > this.containerBoundingRect.width - offset.width) {
if (edgeOffset.left + translate.x > this.containerBoundingRect.width - offset.width && nextNode) {
// If it moves passed the right bounds, then animate it to the first position of the next row.
// We just use the offset of the next node to calculate where to move, because that node's original position
// is exactly where we want to go
Expand Down

0 comments on commit 819bd4b

Please sign in to comment.