From e7b11a2d825d916dbdcb4f3c26586f2ea20bdac1 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sun, 15 Mar 2020 09:47:47 +0000 Subject: [PATCH] Desktop: Fixes #2618: Fixed renaming tag issue --- ReactNativeClient/lib/reducer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ReactNativeClient/lib/reducer.js b/ReactNativeClient/lib/reducer.js index d72a3409a..f797b9555 100644 --- a/ReactNativeClient/lib/reducer.js +++ b/ReactNativeClient/lib/reducer.js @@ -650,8 +650,12 @@ const reducer = (state = defaultState, action) => { break; case 'TAG_UPDATE_ONE': - newState = updateOneItem(state, action); - newState = updateOneItem(newState, action, 'selectedNoteTags'); + { + // We only want to update the selected note tags if the tag belongs to the currently open note + const selectedNoteHasTag = !!state.selectedNoteTags.find(tag => tag.id === action.item.id); + newState = updateOneItem(state, action); + if (selectedNoteHasTag) newState = updateOneItem(newState, action, 'selectedNoteTags'); + } break; case 'NOTE_TAG_REMOVE':