Skip to content

Build your personal knowledge base with Trilium Notes

fix(client): handle read-only in note tree auto-collapse

FliegendeWurst23422731e26a
diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts
index 9b8ab10cd2..825e6d8f8d 100644
--- a/apps/client/src/widgets/note_tree.ts
+++ b/apps/client/src/widgets/note_tree.ts
@@ -1172,16 +1172,19 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
let noneCollapsedYet = true;
- this.tree.getRootNode().visit((node) => {
- if (node.isExpanded() && !noteIdsToKeepExpanded.has(node.data.noteId)) {
- node.setExpanded(false);
-
- if (noneCollapsedYet) {
- toastService.showMessage(t("note_tree.auto-collapsing-notes-after-inactivity"));
- noneCollapsedYet = false;
+ if (!options.is("databaseReadonly")) {
+ // can't change expanded notes when database is readonly
+ this.tree.getRootNode().visit((node) => {
+ if (node.isExpanded() && !noteIdsToKeepExpanded.has(node.data.noteId)) {
+ node.setExpanded(false);
+
+ if (noneCollapsedYet) {
+ toastService.showMessage(t("note_tree.auto-collapsing-notes-after-inactivity"));
+ noneCollapsedYet = false;
+ }
}
- }
- }, false);
+ }, false);
+ }
this.filterHoistedBranch(true);
}, 600 * 1000);