From 16b53c2d440fd06189311d95863a1c4b3719cd55 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Wed, 21 Jul 2021 16:44:59 +0200 Subject: [PATCH] perf(CreateIndex): :zap: Only need allPaths when creating Index, not every active-note-change --- src/MatrixView.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/MatrixView.ts b/src/MatrixView.ts index 5c9faed6..5dbc43e1 100644 --- a/src/MatrixView.ts +++ b/src/MatrixView.ts @@ -174,15 +174,6 @@ export default class MatrixView extends ItemView { const currFile = this.app.workspace.getActiveFile(); const settings = this.plugin.settings; - // SECTION Create Index - - const allPaths = this.dfsAllPaths( - closeImpliedLinks(gChildren, gParents), - currFile.basename - ); - - // !SECTION Create Index - const viewToggleButton = this.contentEl.createEl("button", { text: this.matrixQ ? "List" : "Matrix", }); @@ -196,6 +187,10 @@ export default class MatrixView extends ItemView { text: "Create Index ⚠️", }); createIndexButton.addEventListener("click", () => { + const allPaths = this.dfsAllPaths( + closeImpliedLinks(gChildren, gParents), + currFile.basename + ); const index = this.createIndex(allPaths, currFile.basename, settings); debug(settings, { index }); copyToClipboard(index);