Skip to content

Build your personal knowledge base with Trilium Notes

fix finding note paths of hidden notes, fixes #2262

zadam33aa72eb97e8
diff --git a/src/becca/becca_loader.js b/src/becca/becca_loader.js
index 7018110a01..4d18ad17c1 100644
--- a/src/becca/becca_loader.js
+++ b/src/becca/becca_loader.js
@@ -45,6 +45,10 @@ function load() {
new Option(row);
}
+ for (const noteId in becca.notes) {
+ becca.notes[noteId].sortParents();
+ }
+
becca.loaded = true;
log.info(`Becca (note cache) load took ${Date.now() - start}ms`);
@@ -151,7 +155,7 @@ function branchUpdated(branch) {
if (childNote) {
childNote.flatTextCache = null;
- childNote.resortParents();
+ childNote.sortParents();
}
}
diff --git a/src/becca/becca_service.js b/src/becca/becca_service.js
index afea5af03f..92037178bf 100644
--- a/src/becca/becca_service.js
+++ b/src/becca/becca_service.js
@@ -125,7 +125,7 @@ function getNoteTitleForPath(notePathArray) {
/**
* Returns notePath for noteId from cache. Note hoisting is respected.
- * Archived notes are also returned, but non-archived paths are preferred if available
+ * Archived (and hidden) notes are also returned, but non-archived paths are preferred if available
* - this means that archived paths is returned only if there's no non-archived path
* - you can check whether returned path is archived using isArchived
*/
@@ -140,10 +140,6 @@ function getSomePathInner(note, path, respectHoisting) {
path.push(note.noteId);
path.reverse();
- if (path.includes("hidden")) {
- return false;
- }
-
if (respectHoisting && !path.includes(cls.getHoistedNoteId())) {
return false;
}
diff --git a/src/becca/entities/note.js b/src/becca/entities/note.js
index 91abb37c63..32c9b7fc3f 100644
--- a/src/becca/entities/note.js
+++ b/src/becca/entities/note.js
@@ -611,7 +611,7 @@ class Note extends AbstractEntity {
// will sort the parents so that non-search & non-archived are first and archived at the end
// this is done so that non-search & non-archived paths are always explored as first when looking for note path
- resortParents() {
+ sortParents() {
this.parentBranches.sort((a, b) =>
a.branchId.startsWith('virt-')
|| a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1);
diff --git a/src/public/app/services/note_list_renderer.js b/src/public/app/services/note_list_renderer.js
index 91b266993e..8dc5b8e98d 100644
--- a/src/public/app/services/note_list_renderer.js
+++ b/src/public/app/services/note_list_renderer.js
@@ -153,7 +153,7 @@ class NoteListRenderer {
this.parentNote = parentNote;
const includedNoteIds = this.getIncludedNoteIds();
- this.noteIds = noteIds.filter(noteId => !includedNoteIds.has(noteId));
+ this.noteIds = noteIds.filter(noteId => !includedNoteIds.has(noteId) && noteId !== 'hidden');
if (this.noteIds.length === 0) {
return;
diff --git a/src/services/search/services/search.js b/src/services/search/services/search.js
index 030580fcb8..d43ad69309 100644
--- a/src/services/search/services/search.js
+++ b/src/services/search/services/search.js
@@ -3,7 +3,6 @@
const lex = require('./lex');
const handleParens = require('./handle_parens');
const parse = require('./parse');
-const NoteSet = require("../note_set");
const SearchResult = require("../search_result");
const SearchContext = require("../search_context");
const becca = require('../../../becca/becca');