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
fix broken what links here widget
zadam874972a3d3fb
diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.jsindex cfa387ce91..f4960adb25 100644--- a/src/public/app/entities/note_short.js+++ b/src/public/app/entities/note_short.js@@ -481,6 +481,17 @@ class NoteShort {.map(attributeId => this.treeCache.attributes[attributeId]);}+ /**+ * Get relations which target this note+ *+ * @returns {NoteShort[]}+ */+ async getTargetRelationSourceNotes() {+ const targetRelations = this.getTargetRelations();++ return await this.treeCache.getNotes(targetRelations.map(tr => tr.noteId));+ }+/*** Return note complement which is most importantly note's content*diff --git a/src/public/app/services/tree_cache.js b/src/public/app/services/tree_cache.jsindex c64d631a67..0caa12d56d 100644--- a/src/public/app/services/tree_cache.js+++ b/src/public/app/services/tree_cache.js@@ -141,7 +141,7 @@ class TreeCache {const note = this.notes[attributeRow.noteId];- if (!note.attributes.includes(attributeId)) {+ if (note && !note.attributes.includes(attributeId)) {note.attributes.push(attributeId);}diff --git a/src/public/app/widgets/collapsible_widgets/what_links_here.js b/src/public/app/widgets/collapsible_widgets/what_links_here.jsindex 9f13ece023..1b8f279201 100644--- a/src/public/app/widgets/collapsible_widgets/what_links_here.js+++ b/src/public/app/widgets/collapsible_widgets/what_links_here.js@@ -53,4 +53,4 @@ export default class WhatLinksHereWidget extends CollapsibleWidget {this.refresh();}}-}\ No newline at end of file+}diff --git a/src/routes/api/tree.js b/src/routes/api/tree.jsindex 37e8f00b7e..3a775792fc 100644--- a/src/routes/api/tree.js+++ b/src/routes/api/tree.js@@ -38,7 +38,8 @@ function getNotesAndBranchesAndAttributes(noteIds) {position,isInheritableFROM attributes- WHERE isDeleted = 0 AND noteId IN (???)`, noteIds);+ WHERE isDeleted = 0+ AND (noteId IN (???) OR (type = 'relation' AND value IN (???)))`, noteIds);// sorting in memory is fasterattributes.sort((a, b) => a.position - b.position < 0 ? -1 : 1);