reloading of notes in tree cache when attribute changes

This commit is contained in:
zadam 2019-11-02 08:04:22 +01:00
parent b7b583ff04
commit b471d51cb4
2 changed files with 8 additions and 3 deletions

View File

@ -8,9 +8,6 @@ const RELATION = 'relation';
const RELATION_DEFINITION = 'relation-definition'; 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. * This note's representation is used in note tree and is kept in TreeCache.
*/ */
class NoteShort { class NoteShort {

View File

@ -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 === '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) { if (noteIdsToRefresh.size > 0) {
await reloadNotes(Array.from(noteIdsToRefresh)); await reloadNotes(Array.from(noteIdsToRefresh));
} }