Skip to content

Commit c945c6d

Browse files
committed
fix(react-sortable.jsx): const newList = [...props.list].map((item) =>
); there is copy issue
1 parent 54d778c commit c945c6d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/react-sortable.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class ReactSortable<T extends ItemInterface> extends Component<
5050

5151
// make all state false because we can't change sortable unless a mouse gesture is made.
5252
const newList = [...props.list].map((item) =>
53-
Object.assign(item, {
53+
Object.assign({}, item, {
5454
chosen: false,
5555
selected: false,
5656
})
@@ -238,7 +238,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
238238
removeNodes(customs);
239239

240240
const newList = handleStateAdd(customs, list, evt, clone).map((item) =>
241-
Object.assign(item, {
241+
Object.assign({}, item, {
242242
selected: false,
243243
})
244244
);
@@ -294,7 +294,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
294294

295295
// remove item.selected from list
296296
newList = newList.map((item: T) =>
297-
Object.assign(item, {
297+
Object.assign({}, item, {
298298
selected: false,
299299
})
300300
);
@@ -324,7 +324,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
324324
const newList = list.map((item, index) => {
325325
let newItem = item;
326326
if (index === evt.oldIndex) {
327-
newItem = Object.assign(item, {
327+
newItem = Object.assign({}, item, {
328328
chosen: true,
329329
});
330330
}
@@ -338,7 +338,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
338338
const newList = list.map((item, index) => {
339339
let newItem = item;
340340
if (index === evt.oldIndex) {
341-
newItem = Object.assign(newItem, {
341+
newItem = Object.assign({}, newItem, {
342342
chosen: false,
343343
});
344344
}
@@ -355,7 +355,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
355355
onSelect(evt: MultiDragEvent): void {
356356
const { list, setList } = this.props;
357357
const newList = list.map((item) =>
358-
Object.assign(item, {
358+
Object.assign({}, item, {
359359
selected: false,
360360
})
361361
);
@@ -377,7 +377,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
377377
onDeselect(evt: MultiDragEvent): void {
378378
const { list, setList } = this.props;
379379
const newList = list.map((item) =>
380-
Object.assign(item, {
380+
Object.assign({}, item, {
381381
selected: false,
382382
})
383383
);

0 commit comments

Comments
 (0)