mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 09:16:45 +01:00
fixes to stable sorting
This commit is contained in:
@@ -1147,7 +1147,6 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
let parentsOfAddedNodes = [];
|
||||
|
||||
const allBranchRows = loadResults.getBranchRows();
|
||||
// TODO: this flag is suspicious - why does it matter that all branches in a particular update are deleted?
|
||||
const allBranchesDeleted = allBranchRows.every(branchRow => !!branchRow.isDeleted);
|
||||
|
||||
for (const branchRow of allBranchRows) {
|
||||
@@ -1190,12 +1189,16 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
continue;
|
||||
}
|
||||
|
||||
const found = (parentNode.getChildren() || []).find(child => child.data.noteId === branchRow.noteId);
|
||||
if (!found) {
|
||||
const note = await froca.getNote(branchRow.noteId);
|
||||
const frocaBranch = froca.getBranch(branchRow.branchId);
|
||||
const foundNode = (parentNode.getChildren() || []).find(child => child.data.noteId === branchRow.noteId);
|
||||
if (foundNode) {
|
||||
// the branch already exists in the tree
|
||||
if (branchRow.isExpanded !== foundNode.isExpanded()) {
|
||||
noteIdsToReload.add(frocaBranch.noteId);
|
||||
}
|
||||
} else {
|
||||
// make sure it's loaded
|
||||
const note = await froca.getNote(branchRow.noteId);
|
||||
const frocaBranch = froca.getBranch(branchRow.branchId);
|
||||
|
||||
// we're forcing lazy since it's not clear if the whole required subtree is in froca
|
||||
parentNode.addChildren([this.prepareNode(frocaBranch, true)]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user