Skip to content

Commit

Permalink
fix(react-sortable.jsx): const newList = [...props.list].map((item) =>
Browse files Browse the repository at this point in the history
); there is copy issue
  • Loading branch information
mohan-bitla committed May 18, 2023
1 parent 54d778c commit c945c6d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/react-sortable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class ReactSortable<T extends ItemInterface> extends Component<

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

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

// remove item.selected from list
newList = newList.map((item: T) =>
Object.assign(item, {
Object.assign({}, item, {
selected: false,
})
);
Expand Down Expand Up @@ -324,7 +324,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
const newList = list.map((item, index) => {
let newItem = item;
if (index === evt.oldIndex) {
newItem = Object.assign(item, {
newItem = Object.assign({}, item, {
chosen: true,
});
}
Expand All @@ -338,7 +338,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
const newList = list.map((item, index) => {
let newItem = item;
if (index === evt.oldIndex) {
newItem = Object.assign(newItem, {
newItem = Object.assign({}, newItem, {
chosen: false,
});
}
Expand All @@ -355,7 +355,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
onSelect(evt: MultiDragEvent): void {
const { list, setList } = this.props;
const newList = list.map((item) =>
Object.assign(item, {
Object.assign({}, item, {
selected: false,
})
);
Expand All @@ -377,7 +377,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
onDeselect(evt: MultiDragEvent): void {
const { list, setList } = this.props;
const newList = list.map((item) =>
Object.assign(item, {
Object.assign({}, item, {
selected: false,
})
);
Expand Down

0 comments on commit c945c6d

Please sign in to comment.