From 9b2cb4ac804cccb3a0dda0a1895ee95218833920 Mon Sep 17 00:00:00 2001 From: Davis Haupt Date: Thu, 16 Mar 2023 22:18:34 -0400 Subject: [PATCH] Revert "hang until metadata is found" This reverts commit 74ca39228ad816053285add38b1a142d3375b99e. --- src/calendars/DailyNoteCalendar.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/calendars/DailyNoteCalendar.ts b/src/calendars/DailyNoteCalendar.ts index f8b3244..2584078 100644 --- a/src/calendars/DailyNoteCalendar.ts +++ b/src/calendars/DailyNoteCalendar.ts @@ -1,5 +1,5 @@ import moment from "moment"; -import { CachedMetadata, TFile } from "obsidian"; +import { TFile } from "obsidian"; import { appHasDailyNotesPluginLoaded, createDailyNote, @@ -91,17 +91,12 @@ export default class DailyNoteCalendar extends EditableCalendar { let file = getDailyNote(m, getAllDailyNotes()) as TFile; if (!file) { file = (await createDailyNote(m)) as TFile; - // Since we're relying on Obsidian's markdown parsing for header and list info - // wait until the cache is populated before continuing, since this might be - // a new file. - await this.app.read(file); } - - let metadata: CachedMetadata | null = null; - while (metadata === null) { - metadata = this.app.getMetadata(file); - } - + // Since we're relying on Obsidian's markdown parsing for header and list info + // wait until the cache is populated before continuing, since this might be + // a new file. + await this.app.read(file); + const metadata = this.app.getMetadata(file); if (!metadata) { throw new Error("No metadata for file " + file.path); }