Presently, my table contains editable cells, with the functionality to undo changes to each cell. To achieve this, I initially created a duplicate of each object in the array.
Upon initialization, I mapped the array to create a new array with old values stored in a separate property:
this.previousArr = this.mainArr.map(item => {
item.oldValues = Object.assign({}, item);
return item;
})
When the cancel action is triggered, I restore the cell's old values instead of the new ones:
cancel(action) {
action = Object.assign({}, action.oldValues);
}
However, after testing out this implementation in stackblitz, I noticed that while the values revert back to the old ones in the console, they don't reflect in the actual view. Can you help identify the issue here?