Skip to content

Commit

Permalink
Await dictionaries individually
Browse files Browse the repository at this point in the history
Using `Promise.all()` was causing a weird edge case where one of the dictionaries would not be loaded for some reason. This is well, a fix.
  • Loading branch information
yanthomasdev committed Nov 11, 2024
1 parent 3523c58 commit 592e4ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/status/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ export function findMissingKeys(
}

// TODO: Add integration tests for this function
function loadDictionaries(sourcePath: string, localePath: string) {
async function loadDictionaries(sourcePath: string, localePath: string) {
if (moduleFileRe.test(sourcePath)) {
return Promise.all([loadModule(sourcePath), loadModule(localePath)]);
return [await loadModule(sourcePath), await loadModule(localePath)];
}

if (yamlFileRe.test(sourcePath)) {
return Promise.all([loadYAML(sourcePath), loadYAML(localePath)]);
return [await loadYAML(sourcePath), await loadYAML(localePath)];
}

if (jsonFileRe.test(sourcePath)) {
return Promise.all([loadJSON(sourcePath), loadJSON(localePath)]);
return [await loadJSON(sourcePath), await loadJSON(localePath)];
}

throw new Error(UnsupportedDictionaryFileFormat.message(sourcePath));
Expand Down

0 comments on commit 592e4ff

Please sign in to comment.