Skip to content

Commit 4d4a364

Browse files
nicknisiCompuIves
authored andcommitted
fix async issue with fetching typings from meta (codesandbox#1022)
Fixes codesandbox#1021. Ensure that all fetch Promises have been resolved when returning from the fetchFromMeta method in fetch-dependency-typings
1 parent 083bcf6 commit 4d4a364

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/app/src/app/components/CodeEditor/Monaco/workers/fetch-dependency-typings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ function fetchFromMeta(dependency, version, fetchedPaths) {
191191
throw new Error('No inline typings found.');
192192
}
193193

194-
dtsFiles.forEach(file => {
194+
return Promise.all(dtsFiles.map(file =>
195195
doFetch(`https://cdn.jsdelivr.net/npm/${dependency}@${version}${file}`)
196196
.then(dtsFile =>
197197
addLib(`node_modules/${dependency}${file}`, dtsFile, fetchedPaths)
198198
)
199-
.catch(() => {});
200-
});
199+
.catch(() => {})
200+
));
201201
});
202202
}
203203

0 commit comments

Comments
 (0)