Skip to content

Commit c219859

Browse files
claremacraemnaoumov
andcommitted
fix: Only execute searches after Obsidian finishes loading
This may improve start-up time, when Obsidian opens with notes containing Tasks search results loaded, in Reading mode or Live Preview. This fixed use of a "CodeScript Toolkit" startup script inside notes that were already open in Reading mode when Obsidian was starting up. Thanks to @mnaoumov for pointing this out. Co-Authored-By: Michael Naumov <[email protected]>
1 parent ac2709b commit c219859

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ export default class TasksPlugin extends Plugin {
5959
workspace: this.app.workspace,
6060
events,
6161
});
62-
this.inlineRenderer = new InlineRenderer({ plugin: this });
63-
this.queryRenderer = new QueryRenderer({ plugin: this, events });
62+
63+
this.app.workspace.onLayoutReady(() => {
64+
// Only execute searches after Obsidian finishes loading.
65+
this.inlineRenderer = new InlineRenderer({ plugin: this });
66+
this.queryRenderer = new QueryRenderer({ plugin: this, events });
67+
});
6468

6569
// Update types.json.
6670
this.setObsidianPropertiesTypes();

0 commit comments

Comments
 (0)