Skip to content

Build your personal knowledge base with Trilium Notes

reloading of notes in tree cache when attribute changes

zadamb471d51cb482
diff --git a/src/public/javascripts/entities/note_short.js b/src/public/javascripts/entities/note_short.js
index d0c8cc83b0..9d93c2ff54 100644
--- a/src/public/javascripts/entities/note_short.js
+++ b/src/public/javascripts/entities/note_short.js
@@ -8,9 +8,6 @@ const RELATION = 'relation';
const RELATION_DEFINITION = 'relation-definition';
/**
- * FIXME: rethink how attributes are cached in Note entities since they are long lived inside the cache.
- * Attribute cache should be limited to "transaction".
- *
* This note's representation is used in note tree and is kept in TreeCache.
*/
class NoteShort {
diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js
index 370fbb89ad..cfa1e90e19 100644
--- a/src/public/javascripts/services/tree.js
+++ b/src/public/javascripts/services/tree.js
@@ -784,6 +784,14 @@ ws.subscribeToOutsideSyncMessages(async syncData => {
syncData.filter(sync => sync.entityName === 'note_reordering').forEach(sync => noteIdsToRefresh.add(sync.entityId));
+ syncData.filter(sync => sync.entityName === 'attributes').forEach(sync => {
+ const note = treeCache.notes[sync.noteId];
+
+ if (note && note.attributeCache) {
+ noteIdsToRefresh.add(sync.entityId);
+ }
+ });
+
if (noteIdsToRefresh.size > 0) {
await reloadNotes(Array.from(noteIdsToRefresh));
}