1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-26 18:58:21 +02:00

All: Reducer should not mutate state

This commit is contained in:
Laurent Cozic 2020-06-25 20:27:14 +01:00
parent 20482b2f14
commit 87ccb86f54

View File

@ -467,14 +467,14 @@ function handleHistory(state, action) {
backwardHistoryNotes = backwardHistoryNotes.map(note => {
if (note.id === modNote.id) {
return Object.assign(note, { parent_id: modNote.parent_id, selectedFolderId: modNote.parent_id });
return Object.assign({}, note, { parent_id: modNote.parent_id, selectedFolderId: modNote.parent_id });
}
return note;
});
forwardHistoryNotes = forwardHistoryNotes.map(note => {
if (note.id === modNote.id) {
return Object.assign(note, { parent_id: modNote.parent_id, selectedFolderId: modNote.parent_id });
return Object.assign({}, note, { parent_id: modNote.parent_id, selectedFolderId: modNote.parent_id });
}
return note;
});