Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
small fixes
zadam56506d33a7fe
diff --git a/src/routes/api/tree.js b/src/routes/api/tree.jsindex fc8cf419d5..52d5291283 100644--- a/src/routes/api/tree.js+++ b/src/routes/api/tree.js@@ -1,6 +1,7 @@"use strict";const noteCache = require('../../services/note_cache/note_cache');+const log = require('../../services/log');function getNotesAndBranchesAndAttributes(noteIds) {noteIds = new Set(noteIds);@@ -76,6 +77,11 @@ function getNotesAndBranchesAndAttributes(noteIds) {for (const branchId of collectedBranchIds) {const branch = noteCache.branches[branchId];+ if (!branch) {+ log.error(`Could not find branch for branchId=${branchId}`);+ continue;+ }+branches.push({branchId: branch.branchId,noteId: branch.noteId,diff --git a/src/services/date_notes.js b/src/services/date_notes.jsindex fc8a9205b4..2d9e5dc081 100644--- a/src/services/date_notes.js+++ b/src/services/date_notes.js@@ -152,12 +152,11 @@ function getDateNoteTitle(rootNote, dayNumber, dateObj) {function getDateNote(dateStr) {const rootNote = getRootCalendarNote();- const dayNumber = dateStr.substr(8, 2);-let dateNote = attributeService.getNoteWithLabel(DATE_LABEL, dateStr);if (!dateNote) {const monthNote = getMonthNote(dateStr, rootNote);+ const dayNumber = dateStr.substr(8, 2);dateNote = getNoteStartingWith(monthNote.noteId, dayNumber);diff --git a/src/services/search/services/search.js b/src/services/search/services/search.jsindex 7bcc67fc9b..8e08742fff 100644--- a/src/services/search/services/search.js+++ b/src/services/search/services/search.js@@ -88,7 +88,7 @@ function findNotesWithExpression(expression, searchContext) {const searchResults = noteSet.notes.map(note => executionContext.noteIdToNotePath[note.noteId] || noteCacheService.getSomePath(note))- .filter(notePathArray => notePathArray.includes(cls.getHoistedNoteId()))+ .filter(notePathArray => notePathArray && notePathArray.includes(cls.getHoistedNoteId())).map(notePathArray => new SearchResult(notePathArray));for (const res of searchResults) {