mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix broken what links here widget
This commit is contained in:
parent
6d095b7250
commit
874972a3d3
@ -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
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -53,4 +53,4 @@ export default class WhatLinksHereWidget extends CollapsibleWidget {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
||||
position,
|
||||
isInheritable
|
||||
FROM 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 faster
|
||||
attributes.sort((a, b) => a.position - b.position < 0 ? -1 : 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user