Skip to content

Commit

Permalink
fix(List/Matrix View): 🐛 Draw l/m view onLoad, not onOpen
Browse files Browse the repository at this point in the history
This should remove the extra delay in drawing the l/m view when first opening Obsidian
  • Loading branch information
SkepticMystic committed Aug 2, 2021
1 parent a17000e commit 7f4078d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -92,9 +96,9 @@ export default class MatrixView extends ItemView {

async onOpen(): Promise<void> {
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")
// );
Expand Down

0 comments on commit 7f4078d

Please sign in to comment.