mirror of
https://github.com/zadam/trilium.git
synced 2026-02-24 14:44:28 +01:00
fix(tree): performance issue due to batch update
Some checks failed
Checks / main (push) Has been cancelled
Some checks failed
Checks / main (push) Has been cancelled
This commit is contained in:
parent
ddba0e823c
commit
0272189b22
@ -1306,7 +1306,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
}
|
||||
|
||||
async #executeTreeUpdates(refreshCtx: RefreshContext, loadResults: LoadResults) {
|
||||
await this.batchUpdate(async () => {
|
||||
const batchUpdate = async () => {
|
||||
for (const noteId of refreshCtx.noteIdsToReload) {
|
||||
for (const node of this.getNodesByNoteId(noteId)) {
|
||||
await node.load(true);
|
||||
@ -1322,7 +1322,14 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (refreshCtx.noteIdsToReload.size + refreshCtx.noteIdsToUpdate.size >= 10) {
|
||||
// Despite the name, batchUpdate is actually slowing things down for smaller updates.
|
||||
await this.batchUpdate(batchUpdate);
|
||||
} else {
|
||||
await batchUpdate();
|
||||
}
|
||||
|
||||
// for some reason, node update cannot be in the batchUpdate() block (node is not re-rendered)
|
||||
for (const noteId of refreshCtx.noteIdsToUpdate) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user