Skip to content

Commit a32ee60

Browse files
committed
fixing bug and changing text
1 parent 735bd10 commit a32ee60

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/components/sortable/Sortable.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ function useSortable(initialItems) {
4949
return items;
5050
}
5151

52-
// This is the whole state of the library is managed
53-
// this "produce" stuff comes from immer and makes updating immutable data less painful
52+
// This is where the state is managed
53+
// "produce" stuff comes from immer and makes updating immutable data less painful
5454
function reducer(state, action) {
5555
switch (action.type) {
5656
// When sortable components are mounted they are added to "elements" array
@@ -129,8 +129,7 @@ function Sortable(props) {
129129
containerRef.current.addEventListener("touchstart", dragStart, false);
130130
window.addEventListener("touchend", dragEnd, false);
131131
window.addEventListener("touchmove", drag, false);
132-
// If your effect returns a function React will run it when it is time to clean up
133-
// This has similar logic to componentWillUnmount
132+
// If your effect returns a function React will run it when it is time to clean up (componentWillUnmount)
134133
return () => {
135134
containerRef.current.removeEventListener('mousedown', dragStart, false);
136135
window.removeEventListener('mousemove', drag, false);
@@ -167,7 +166,7 @@ function Sortable(props) {
167166

168167
// We want to animate our nodes
169168
state.nodes.forEach((node, i) => {
170-
if (i !== state.draggedElement.draggedElement) {
169+
if (i !== state.draggedElementIndex) {
171170
node.style.webkitTransition = 'transform 0.3s';
172171
}
173172
});

0 commit comments

Comments
 (0)