From 87ccb86f5407e413618e23a6650660e93b4f2443 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 25 Jun 2020 20:27:14 +0100 Subject: [PATCH] All: Reducer should not mutate state --- ReactNativeClient/lib/reducer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactNativeClient/lib/reducer.js b/ReactNativeClient/lib/reducer.js index 909ff2acf..d141ed99c 100644 --- a/ReactNativeClient/lib/reducer.js +++ b/ReactNativeClient/lib/reducer.js @@ -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; });