From 5ad47d38665fbb78847cc01514607047dd3fa341 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 17 Mar 2023 20:44:26 +0100 Subject: [PATCH] fix cache invalidation upon note title change --- src/becca/becca_loader.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/becca/becca_loader.js b/src/becca/becca_loader.js index ad4c90a10..f7659e964 100644 --- a/src/becca/becca_loader.js +++ b/src/becca/becca_loader.js @@ -70,7 +70,9 @@ function reload() { } function postProcessEntityUpdate(entityName, entity) { - if (entityName === 'branches') { + if (entityName === 'notes') { + noteUpdated(entity); + } else if (entityName === 'branches') { branchUpdated(entity); } else if (entityName === 'attributes') { attributeUpdated(entity); @@ -161,6 +163,15 @@ function branchDeleted(branchId) { delete becca.branches[branch.branchId]; } +function noteUpdated(entity) { + const note = becca.notes[entity.noteId]; + + if (note) { + // type / mime could have been changed, and they are present in flatTextCache + note.flatTextCache = null; + } +} + function branchUpdated(branch) { const childNote = becca.notes[branch.noteId];