link map WIP

This commit is contained in:
zadam
2019-06-04 22:57:10 +02:00
parent 87b16f3325
commit 4b96ada781
3 changed files with 54 additions and 12 deletions

View File

@@ -14,7 +14,7 @@ async function getLinks(noteIds) {
WHERE (noteId IN (???) OR value IN (???))
AND type = 'relation'
AND isDeleted = 0
`, noteIds);
`, Array.from(noteIds));
}
async function getLinkMap(req) {
@@ -27,7 +27,7 @@ async function getLinkMap(req) {
const newLinks = await getLinks(noteIds);
const newNoteIds = new Set(newLinks.map(l => l.noteId).concat(newLinks.map(l => l.targetNoteId)));
if (newNoteIds.length === noteIds.length) {
if (newNoteIds.size === noteIds.size) {
// no new note discovered, no need to search any further
break;
}