mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 01:06:36 +01:00
changes in retrieval of initial note tree and then updates
This commit is contained in:
@@ -13,12 +13,6 @@ class TreeCache {
|
||||
this.init();
|
||||
}
|
||||
|
||||
load(noteRows, branchRows, relations) {
|
||||
this.init();
|
||||
|
||||
this.addResp(noteRows, branchRows, relations);
|
||||
}
|
||||
|
||||
init() {
|
||||
/** @type {Object.<string, string>} */
|
||||
this.parents = {};
|
||||
@@ -35,7 +29,13 @@ class TreeCache {
|
||||
this.branches = {};
|
||||
}
|
||||
|
||||
addResp(noteRows, branchRows, relations) {
|
||||
load(noteRows, branchRows) {
|
||||
this.init();
|
||||
|
||||
this.addResp(noteRows, branchRows);
|
||||
}
|
||||
|
||||
addResp(noteRows, branchRows) {
|
||||
for (const noteRow of noteRows) {
|
||||
const note = new NoteShort(this, noteRow);
|
||||
|
||||
@@ -47,10 +47,6 @@ class TreeCache {
|
||||
|
||||
this.addBranch(branch);
|
||||
}
|
||||
|
||||
for (const relation of relations) {
|
||||
this.addBranchRelationship(relation.branchId, relation.childNoteId, relation.parentNoteId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +71,7 @@ class TreeCache {
|
||||
delete this.notes[noteId];
|
||||
}
|
||||
|
||||
this.addResp(resp.notes, resp.branches, resp.relations);
|
||||
this.addResp(resp.notes, resp.branches);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +95,7 @@ class TreeCache {
|
||||
if (missingNoteIds.length > 0) {
|
||||
const resp = await server.post('tree/load', { noteIds: missingNoteIds });
|
||||
|
||||
this.addResp(resp.notes, resp.branches, resp.relations);
|
||||
this.addResp(resp.notes, resp.branches);
|
||||
}
|
||||
|
||||
return noteIds.map(noteId => {
|
||||
@@ -168,7 +164,7 @@ class TreeCache {
|
||||
if (missingBranchIds.length > 0) {
|
||||
const resp = await server.post('tree/load', { branchIds: branchIds });
|
||||
|
||||
this.addResp(resp.notes, resp.branches, resp.relations);
|
||||
this.addResp(resp.notes, resp.branches);
|
||||
}
|
||||
|
||||
return branchIds.map(branchId => {
|
||||
|
||||
Reference in New Issue
Block a user