Skip to content

Commit f45415a

Browse files
committed
Avoid invalid session.loadPlugins early exit
`loadPlugins` sometimes get invoked before the project config is available. In that case, it will not load the plugins, but when the next chance comes to do so, it will take the early exit ("we already tried to load plugins") instead of loading them.
1 parent cace3f6 commit f45415a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/myst-cli/src/session/session.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,15 @@ export class Session implements ISession {
164164
async loadPlugins() {
165165
// Early return if a promise has already been initiated
166166
if (this._pluginPromise) return this._pluginPromise;
167-
this._pluginPromise = loadPlugins(this);
168-
this.plugins = await this._pluginPromise;
169-
return this.plugins;
167+
168+
const state = this.store.getState();
169+
const projConfig = selectors.selectCurrentProjectConfig(state);
170+
171+
if (projConfig) {
172+
this._pluginPromise = loadPlugins(this);
173+
this.plugins = await this._pluginPromise;
174+
return this.plugins;
175+
}
170176
}
171177

172178
sourcePath(): string {

0 commit comments

Comments
 (0)