From a923b68b880164826b2be56e50b87481f2cd1341 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Sun, 19 Jun 2022 20:14:55 +0200 Subject: [PATCH] Fixed #68 --- src/notes.ts | 4 ++-- src/search.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/notes.ts b/src/notes.ts index 957cdbf..8445058 100644 --- a/src/notes.ts +++ b/src/notes.ts @@ -47,8 +47,8 @@ export function getNoteFromCache(key: string): IndexedNote | undefined { export function getNonExistingNotesFromCache(): IndexedNote[] { return Object.values(notesCache).filter(note => note.doesNotExist) } -export function addNoteToCache(key: string, note: IndexedNote): void { - notesCache[key] = note +export function addNoteToCache(filename: string, note: IndexedNote): void { + notesCache[filename] = note } export function removeNoteFromCache(key: string): void { delete notesCache[key] diff --git a/src/search.ts b/src/search.ts index 9a81a47..d510afb 100644 --- a/src/search.ts +++ b/src/search.ts @@ -356,9 +356,9 @@ export async function addToIndex(file: TAbstractFile): Promise { */ export function addNonExistingToIndex(name: string, parent: string): void { name = removeAnchors(name) - if (getNoteFromCache(name)) return - const filename = name + (name.endsWith('.md') ? '' : '.md') + if (getNoteFromCache(filename)) return + const note = { path: filename, basename: name,