From ff8b8a9a7df93b5f88e86a224b634f538b36637b Mon Sep 17 00:00:00 2001 From: Nathan George Date: Wed, 8 Feb 2023 01:45:36 -0500 Subject: [PATCH] Fixed files not hiding on obsidian initial load --- src/main.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 5f3ee9c..a153549 100644 --- a/src/main.ts +++ b/src/main.ts @@ -63,10 +63,14 @@ export default class FileHider extends Plugin { }) ); - this.app.workspace.onLayoutReady(() => { - for (const path of this.settings.hiddenList) { - changePathVisibility(path, this.settings.hidden); - }; + this.app.workspace.onLayoutReady(() => + { + // Timeout is used to delay until the file explorer is loaded. Delay of 0 works, but I set it to 200 just to be safe. + setTimeout(() => { + for (const path of this.settings.hiddenList) { + changePathVisibility(path, this.settings.hidden); + }; + }, 200); }); new VisibilityToggleCommand(this);