Skip to content

Commit bc9c18d

Browse files
committed
Fix extension host not starting if starting on other page
1 parent 0fcce35 commit bc9c18d

File tree

1 file changed

+13
-2
lines changed
  • packages/app/src/app/overmind/effects/vscode/extensionHostWorker/common

1 file changed

+13
-2
lines changed

packages/app/src/app/overmind/effects/vscode/extensionHostWorker/common/fs.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ export async function initializeBrowserFS({
117117
}
118118

119119
if (syncSandbox) {
120+
// Resolve after 3s, if it doesn't resolve, vscode won't be able to resolve the ext host
121+
// and it won't try to reconnect.
122+
const timeout = setTimeout(() => {
123+
resolve();
124+
}, 3000);
125+
126+
const callResolve = () => {
127+
clearTimeout(timeout);
128+
resolve();
129+
};
130+
120131
self.addEventListener('message', evt => {
121132
// Some messages are specific to this worker
122133
if (!evt.data.$fs_ids || !evt.data.$fs_ids.includes(fsId)) {
@@ -142,7 +153,7 @@ export async function initializeBrowserFS({
142153
touchFileSystem();
143154
if (isInitialSync) {
144155
isInitialSync = false;
145-
resolve();
156+
callResolve();
146157
}
147158
break;
148159
}
@@ -170,7 +181,7 @@ export async function initializeBrowserFS({
170181
$data: {},
171182
});
172183
} else {
173-
resolve();
184+
callResolve();
174185
}
175186
break;
176187
}

0 commit comments

Comments
 (0)