Skip to content

Commit

Permalink
fix(Stats View): 🐛 Close stats view on unload
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Aug 3, 2021
1 parent ed84c2d commit 6931256
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default class BreadcrumbsPlugin extends Plugin {
},
});

this.addRibbonIcon("dice", "Make Adjacency Matrix", () =>
this.addRibbonIcon("dice", "Breadcrumbs Visualisation", () =>
new VisModal(this.app, this).open()
);

Expand Down Expand Up @@ -443,9 +443,13 @@ export default class BreadcrumbsPlugin extends Plugin {
onunload(): void {
console.log("unloading");
// Detach matrix view
const openLeaves = this.app.workspace.getLeavesOfType(
VIEW_TYPE_BREADCRUMBS_MATRIX
);
const openLeaves = [
VIEW_TYPE_BREADCRUMBS_MATRIX,
VIEW_TYPE_BREADCRUMBS_STATS,
]
.map((type) => this.app.workspace.getLeavesOfType(type))
.flat(1);

openLeaves.forEach((leaf) => leaf.detach());

// Empty trailDiv
Expand Down

0 comments on commit 6931256

Please sign in to comment.