From c4b0c449197959d29eb5302a66a52f82ba6415f1 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 14 Dec 2022 19:26:39 +0100 Subject: [PATCH] change of archived label should force a reload of the parents since it can change its visibility status, fixes #3422 --- src/public/app/widgets/note_tree.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 576aa7da7..1de9aa5a5 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -1047,7 +1047,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { const noteIdsToReload = new Set(); for (const ecAttr of loadResults.getAttributes()) { - if (ecAttr.type === 'label' && ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'archived', 'color'].includes(ecAttr.name)) { + if (ecAttr.type === 'label' && ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'color'].includes(ecAttr.name)) { if (ecAttr.isInheritable) { noteIdsToReload.add(ecAttr.noteId); } @@ -1055,6 +1055,17 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { noteIdsToUpdate.add(ecAttr.noteId); } } + else if (ecAttr.type === 'label' && ecAttr.name === 'archived') { + const note = froca.getNoteFromCache(ecAttr.noteId); + + if (note) { + // change of archived status can mean the note should not be displayed in the tree at all + // depending on the value of this.hideArchivedNotes + for (const parentNote of note.getParentNotes()) { + noteIdsToReload.add(parentNote.noteId); + } + } + } else if (ecAttr.type === 'relation' && ecAttr.name === 'template') { // missing handling of things inherited from template noteIdsToReload.add(ecAttr.noteId);