From 7f4078d7314fd942e354df43f684efbe80d39a67 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Mon, 2 Aug 2021 11:14:09 +0200 Subject: [PATCH] fix(List/Matrix View): :bug: Draw l/m view onLoad, not onOpen This should remove the extra delay in drawing the l/m view when first opening Obsidian --- src/MatrixView.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/MatrixView.ts b/src/MatrixView.ts index f243aa7e..7d2d8778 100644 --- a/src/MatrixView.ts +++ b/src/MatrixView.ts @@ -31,6 +31,10 @@ export default class MatrixView extends ItemView { await this.plugin.saveSettings(); this.matrixQ = this.plugin.settings.defaultView; + this.app.workspace.onLayoutReady(async () => { + setTimeout(async () => await this.draw(), DATAVIEW_INDEX_DELAY); + }); + this.plugin.addCommand({ id: "local-index", name: "Copy a Local Index to the clipboard", @@ -92,9 +96,9 @@ export default class MatrixView extends ItemView { async onOpen(): Promise { await this.plugin.saveSettings(); - this.app.workspace.onLayoutReady(async () => { - setTimeout(async () => await this.draw(), DATAVIEW_INDEX_DELAY); - }); + // this.app.workspace.onLayoutReady(async () => { + // setTimeout(async () => await this.draw(), DATAVIEW_INDEX_DELAY); + // }); // this.app.workspace.on("dataview:api-ready", () => // console.log("dv ready") // );