Skip to content

Commit

Permalink
Revert "hang until metadata is found"
Browse files Browse the repository at this point in the history
This reverts commit 74ca392.
  • Loading branch information
davish committed Mar 17, 2023
1 parent 272ecbe commit 9b2cb4a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/calendars/DailyNoteCalendar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import moment from "moment";
import { CachedMetadata, TFile } from "obsidian";
import { TFile } from "obsidian";
import {
appHasDailyNotesPluginLoaded,
createDailyNote,
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 9b2cb4a

Please sign in to comment.