Skip to content

Commit a4bce4f

Browse files
authored
Fix extension host loading (codesandbox#3165)
1 parent f6ecdcc commit a4bce4f

File tree

1 file changed

+10
-4
lines changed
  • packages/app/src/app/overmind/effects/vscode

1 file changed

+10
-4
lines changed

packages/app/src/app/overmind/effects/vscode/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ export class VSCodeEffect {
292292
public async changeSandbox(sandbox: Sandbox, setFs: (fs: SandboxFs) => void) {
293293
await this.initialized;
294294

295+
const isFirstLoad = !!this.modelsHandler;
296+
295297
if (this.modelsHandler) {
296298
this.modelsHandler.dispose();
297299
}
@@ -311,10 +313,14 @@ export class VSCodeEffect {
311313

312314
setFs(this.sandboxFsSync.create(sandbox));
313315

314-
this.editorApi.extensionService.stopExtensionHost();
315-
this.sandboxFsSync.sync(() => {
316-
this.editorApi.extensionService.startExtensionHost();
317-
});
316+
if (isFirstLoad) {
317+
this.editorApi.extensionService.stopExtensionHost();
318+
this.sandboxFsSync.sync(() => {
319+
this.editorApi.extensionService.startExtensionHost();
320+
});
321+
} else {
322+
this.sandboxFsSync.sync(() => {});
323+
}
318324
}
319325

320326
public async setModuleCode(module: Module) {

0 commit comments

Comments
 (0)