From 55d9a3e4aa7f9b21231e051a13d9d2c2d856f512 Mon Sep 17 00:00:00 2001 From: WFH Brian Date: Thu, 1 Aug 2024 16:44:03 -0400 Subject: [PATCH] wait for Obsidian Sync notive in view --- src/smart_obsidian_view.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/smart_obsidian_view.js b/src/smart_obsidian_view.js index a26d4c55..eb1ba66c 100644 --- a/src/smart_obsidian_view.js +++ b/src/smart_obsidian_view.js @@ -15,13 +15,11 @@ export class SmartObsidianView extends ItemView { get env() { return this.plugin.env; } get config() { return this.plugin.settings; } render_template(template_name, data) { - // console.log("rendering template", template_name); if (!this.templates[template_name]) throw new Error(`Template '${template_name}' not found.`); return ejs.render(this.templates[template_name], data, { context: this.view_context }); } get view_context() { return { - // app: this.plugin.app, attribution: this.templates.attribution, get_icon: this.get_icon.bind(this), settings: this.plugin.settings, @@ -29,10 +27,13 @@ export class SmartObsidianView extends ItemView { } async wait_for_env_to_load() { if (!this.env?.entities_loaded) { - // set loading message - this.containerEl.children[1].innerHTML = "Loading Smart Connections..."; // wait for entities to be initialized while (!this.env?.entities_loaded){ + const loading_msg = this.env.waiting_for_obsidian_sync ? "Waiting for Obsidian Sync to finish..." : "Loading Smart Connections..."; + // set loading message + if(this.containerEl.children[1].innerHTML !== loading_msg){ + this.containerEl.children[1].innerHTML = loading_msg; + } await new Promise(r => setTimeout(r, 2000)); } }