Skip to content

Commit a57975c

Browse files
hubdrplClaudéric Demers
authored andcommitted
fix: virtualized collection grid bug
1 parent 1a2c87e commit a57975c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/SortableContainer/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,10 @@ export default function sortableContainer(
671671
// If it moves passed the right bounds, then animate it to the first position of the next row.
672672
// We just use the offset of the next node to calculate where to move, because that node's original position
673673
// is exactly where we want to go
674-
translate.x = nextNode.edgeOffset.left - edgeOffset.left;
675-
translate.y = nextNode.edgeOffset.top - edgeOffset.top;
674+
if (nextNode) {
675+
translate.x = nextNode.edgeOffset.left - edgeOffset.left;
676+
translate.y = nextNode.edgeOffset.top - edgeOffset.top;
677+
}
676678
}
677679
if (this.newIndex === null) {
678680
this.newIndex = index;
@@ -696,8 +698,10 @@ export default function sortableContainer(
696698
// If it moves passed the left bounds, then animate it to the last position of the previous row.
697699
// We just use the offset of the previous node to calculate where to move, because that node's original position
698700
// is exactly where we want to go
699-
translate.x = prevNode.edgeOffset.left - edgeOffset.left;
700-
translate.y = prevNode.edgeOffset.top - edgeOffset.top;
701+
if (prevNode) {
702+
translate.x = prevNode.edgeOffset.left - edgeOffset.left;
703+
translate.y = prevNode.edgeOffset.top - edgeOffset.top;
704+
}
701705
}
702706
this.newIndex = index;
703707
}

0 commit comments

Comments
 (0)