Skip to content

Commit f6ad5bf

Browse files
committed
let settled accept multiple proms + i18n
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 2837c41 commit f6ad5bf

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/i18n/strings/en_EN.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
2-
"Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.",
3-
"The message from the parser is: %(message)s": "The message from the parser is: %(message)s",
4-
"Invalid JSON": "Invalid JSON",
5-
"Your Riot is misconfigured": "Your Riot is misconfigured",
62
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
3+
"Your Riot is misconfigured": "Your Riot is misconfigured",
74
"Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.",
85
"Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.",
6+
"Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.",
7+
"The message from the parser is: %(message)s": "The message from the parser is: %(message)s",
8+
"Invalid JSON": "Invalid JSON",
9+
"Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.",
910
"Open user settings": "Open user settings",
1011
"Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
1112
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",

src/vector/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ if ('serviceWorker' in navigator) {
3333
navigator.serviceWorker.register('sw.js');
3434
}
3535

36-
async function settled(prom: Promise<any>) {
37-
try {
38-
await prom;
39-
} catch (e) {
40-
console.error(e);
36+
async function settled(...promises: Array<Promise<any>>) {
37+
for (const prom of promises) {
38+
try {
39+
await prom;
40+
} catch (e) {
41+
console.error(e);
42+
}
4143
}
4244
}
4345

@@ -141,9 +143,7 @@ async function start() {
141143
const loadSkinPromise = loadSkin();
142144

143145
// await things settling so that any errors we have to render have features like i18n running
144-
await settled(loadSkinPromise);
145-
await settled(loadThemePromise);
146-
await settled(loadLanguagePromise);
146+
await settled(loadSkinPromise, loadThemePromise, loadLanguagePromise);
147147

148148
// ##########################
149149
// error handling begins here
@@ -173,7 +173,7 @@ async function start() {
173173
// await things starting successfully
174174
// ##################################
175175
await loadOlmPromise;
176-
await settled(loadSkinPromise);
176+
await loadSkinPromise;
177177
await loadThemePromise;
178178
await loadLanguagePromise;
179179

0 commit comments

Comments
 (0)