This commit is contained in:
zadam
2020-01-29 22:32:22 +01:00
parent b65631be7e
commit 48b401164a
5 changed files with 26 additions and 20 deletions

View File

@@ -232,10 +232,14 @@ class TreeCache {
// FIXME does not actually belong here
async processSyncRows(syncRows) {
const noteIdsToReload = [];
const loadResults = new LoadResults(this);
syncRows.filter(sync => sync.entityName === 'notes').forEach(sync => {
loadResults.addNote(sync.entityId, sync.sourceId);
});
syncRows.filter(sync => sync.entityName === 'branches').forEach(sync => {
noteIdsToReload.push(sync.parentNoteId);
noteIdsToReload.push(sync.noteId);
@@ -243,12 +247,6 @@ class TreeCache {
loadResults.addBranch(sync.entityId, sync.sourceId);
});
syncRows.filter(sync => sync.entityName === 'notes').forEach(sync => {
noteIdsToReload.push(sync.entityId);
loadResults.addNote(sync.entityId, sync.sourceId);
});
syncRows.filter(sync => sync.entityName === 'note_reordering').forEach(sync => {
noteIdsToReload.push(sync.entityId);
@@ -267,8 +265,6 @@ class TreeCache {
loadResults.addNoteRevision(sync.entityId, sync.noteId, sync.sourceId);
});
await this.reloadNotes(noteIdsToReload);
const appContext = (await import('./app_context.js')).default;
appContext.trigger('entitiesReloaded', {loadResults});
}