cloning is now done without reloading the whole tree

This commit is contained in:
zadam
2019-03-18 22:33:19 +01:00
parent 3f656ea76f
commit ca0d17d93a
6 changed files with 52 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
import treeService from './tree.js';
import treeCache from './tree_cache.js';
import server from './server.js';
async function cloneNoteTo(childNoteId, parentNoteId, prefix) {
@@ -11,7 +12,9 @@ async function cloneNoteTo(childNoteId, parentNoteId, prefix) {
return;
}
await treeService.reload();
treeCache.addBranchRelationship(resp.branchId, childNoteId, parentNoteId);
await treeService.reloadNote(parentNoteId);
}
// beware that first arg is noteId and second is branchId!
@@ -23,7 +26,11 @@ async function cloneNoteAfter(noteId, afterBranchId) {
return;
}
await treeService.reload();
const afterBranch = await treeCache.getBranch(afterBranchId);
treeCache.addBranchRelationship(resp.branchId, noteId, afterBranch.parentNoteId);
await treeService.reloadNote(afterBranch.parentNoteId);
}
export default {