Skip to content

Commit

Permalink
fix: 🐛 Previously checking for plugins.dataview.api, which won't exis…
Browse files Browse the repository at this point in the history
…t if !dataview
  • Loading branch information
SkepticMystic committed Aug 14, 2021
1 parent 896af02 commit 5bc7cc5
Showing 1 changed file with 7 additions and 46 deletions.
53 changes: 7 additions & 46 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export default class BreadcrumbsPlugin extends Plugin {
);

const initEverything = async () => {
console.log("initialising everything");
this.currGraphs = await this.initGraphs();

this.initStatsView(VIEW_TYPE_BREADCRUMBS_STATS);
Expand Down Expand Up @@ -209,50 +208,12 @@ export default class BreadcrumbsPlugin extends Plugin {
// }

this.app.workspace.onLayoutReady(async () => {
setTimeout(async () => {
await initEverything();
// this.currGraphs = await this.initGraphs();

// this.initStatsView(VIEW_TYPE_BREADCRUMBS_STATS);
// this.initMatrixView(VIEW_TYPE_BREADCRUMBS_MATRIX);

// if (this.settings.showTrail) {
// await this.drawTrail();
// }

// this.registerEvent(
// this.app.workspace.on("active-leaf-change", async () => {
// if (this.settings.refreshIndexOnActiveLeafChange) {
// // refreshIndex does everything in one
// await this.refreshIndex();
// } else {
// // If it is not called, active-leaf-change still needs to trigger a redraw
// const activeView = this.getActiveMatrixView();
// if (activeView) {
// await activeView.draw();
// }
// if (this.settings.showTrail) {
// await this.drawTrail();
// }
// }
// })
// );

// // ANCHOR autorefresh interval
// if (this.settings.refreshIntervalTime > 0) {
// this.refreshIntervalID = window.setInterval(async () => {
// this.currGraphs = await this.initGraphs();
// if (this.settings.showTrail) {
// await this.drawTrail();
// }
// const activeView = this.getActiveMatrixView();
// if (activeView) {
// await activeView.draw();
// }
// }, this.settings.refreshIntervalTime * 1000);
// this.registerInterval(this.refreshIntervalID);
// }
}, this.settings.dvWaitTime);
setTimeout(
async () => {
await initEverything();
},
this.app.plugins.plugins.dataview ? this.settings.dvWaitTime : 3000
);
});

addIcon(TRAIL_ICON, TRAIL_ICON_SVG);
Expand Down Expand Up @@ -331,7 +292,7 @@ export default class BreadcrumbsPlugin extends Plugin {
debug(this.settings, "initialising graphs");
const files = this.app.vault.getMarkdownFiles();

const dvQ = !!this.app.plugins.plugins.dataview.api;
const dvQ = !!this.app.plugins.plugins.dataview?.api;

const fileFrontmatterArr: dvFrontmatterCache[] = dvQ
? getDVMetadataCache(this.app, this.settings, files)
Expand Down

0 comments on commit 5bc7cc5

Please sign in to comment.