From 77650057b865d1859de2d24f8f97ea45a2921a0e Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Mon, 22 Nov 2021 11:07:46 +0200 Subject: [PATCH] fix: :bug: Convert setting name: Safer check + save changes --- main.js | 16 +++------------- src/main.ts | 9 +++------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/main.js b/main.js index 7f0f794c..2ec8d48e 100644 --- a/main.js +++ b/main.js @@ -20735,14 +20735,6 @@ module.exports = __webpack_require__(/*! /home/travis/build/feathericons/feather * This module contains various utility functions commonly used in Obsidian plugins. * @module obsidian-community-lib */ -/** - * You can await this Function to delay execution - * - * @param delay The delay in ms - */ -async function wait(delay) { - return new Promise((resolve) => setTimeout(resolve, delay)); -} /** * Adds a specific Feather Icon to Obsidian. * @@ -36167,9 +36159,10 @@ class BCPlugin extends obsidian.Plugin { console.log("loading breadcrumbs plugin"); await this.loadSettings(); // Prevent breaking change - if (this.settings.userHierarchies) { + if (this.settings.hasOwnProperty("userHierarchies")) { this.settings.userHiers = this.settings.userHierarchies; delete this.settings.userHierarchies; + await this.saveSettings(); } ["prev", "next"].forEach((dir) => { this.settings.userHiers.forEach(async (hier, i) => { @@ -36611,10 +36604,7 @@ class BCPlugin extends obsidian.Plugin { ? this.getDVMetadataCache(files) : this.getObsMetadataCache(files); if (fileFrontmatterArr[0] === undefined) { - await wait(1000); - fileFrontmatterArr = dvQ - ? this.getDVMetadataCache(files) - : this.getObsMetadataCache(files); + return new graphology_umd_min.MultiGraph(); } debugGroupStart(settings, "debugMode", "Hierarchy Note Adjacency List"); const hierarchyNotesArr = []; diff --git a/src/main.ts b/src/main.ts index dcf96150..1d169acb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -118,10 +118,10 @@ export default class BCPlugin extends Plugin { await this.loadSettings(); // Prevent breaking change - - if (this.settings.userHierarchies) { + if (this.settings.hasOwnProperty("userHierarchies")) { this.settings.userHiers = this.settings.userHierarchies; delete this.settings.userHierarchies; + await this.saveSettings(); } ["prev", "next"].forEach((dir) => { @@ -689,10 +689,7 @@ export default class BCPlugin extends Plugin { : this.getObsMetadataCache(files); if (fileFrontmatterArr[0] === undefined) { - await wait(1000); - fileFrontmatterArr = dvQ - ? this.getDVMetadataCache(files) - : this.getObsMetadataCache(files); + return new MultiGraph(); } debugGroupStart(settings, "debugMode", "Hierarchy Note Adjacency List");