mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
fix note tree flickering (note cache was not updated when expanded status changed)
This commit is contained in:
@@ -5,6 +5,7 @@ const utils = require('../../services/utils');
|
||||
const entityChangesService = require('../../services/entity_changes.js');
|
||||
const treeService = require('../../services/tree');
|
||||
const noteService = require('../../services/notes');
|
||||
const noteCache = require('../../services/note_cache/note_cache');
|
||||
const repository = require('../../services/repository');
|
||||
const TaskContext = require('../../services/task_context');
|
||||
|
||||
@@ -126,6 +127,12 @@ function setExpanded(req) {
|
||||
sql.execute("UPDATE branches SET isExpanded = ? WHERE branchId = ?", [expanded, branchId]);
|
||||
// we don't sync expanded label
|
||||
// also this does not trigger updates to the frontend, this would trigger too many reloads
|
||||
|
||||
const branch = noteCache.branches[branchId];
|
||||
|
||||
if (branch) {
|
||||
branch.isExpanded = !!expanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +155,14 @@ function setExpandedForSubtree(req) {
|
||||
|
||||
sql.executeMany(`UPDATE branches SET isExpanded = ${expanded} WHERE branchId IN (???)`, branchIds);
|
||||
|
||||
for (const branchId of branchIds) {
|
||||
const branch = noteCache.branches[branchId];
|
||||
|
||||
if (branch) {
|
||||
branch.isExpanded = !!expanded;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
branchIds
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user