Added missing async/await calls
- throughout the theme activation flow there are several missing awaits and necessary async keywords - we should be waiting on these processes, not letting them complete indeterministically
This commit is contained in:
parent
b98fd62a3d
commit
6247aa4d8b
@ -50,7 +50,7 @@ class Bridge {
|
||||
return themeEngine.getActive();
|
||||
}
|
||||
|
||||
activateTheme(loadedTheme, checkedTheme) {
|
||||
async activateTheme(loadedTheme, checkedTheme) {
|
||||
let settings = {
|
||||
locale: settingsCache.get('lang')
|
||||
};
|
||||
@ -68,12 +68,12 @@ class Bridge {
|
||||
|
||||
if (previousGhostAPI !== undefined && (previousGhostAPI !== currentGhostAPI)) {
|
||||
events.emit('services.themes.api.changed');
|
||||
this.reloadFrontend();
|
||||
await this.reloadFrontend();
|
||||
}
|
||||
|
||||
const cardAssetConfig = this.getCardAssetConfig();
|
||||
debug('reload card assets config', cardAssetConfig);
|
||||
cardAssetService.load(cardAssetConfig);
|
||||
await cardAssetService.load(cardAssetConfig);
|
||||
} catch (err) {
|
||||
logging.error(new errors.InternalServerError({
|
||||
message: tpl(messages.activateFailed, {theme: loadedTheme.name}),
|
||||
@ -98,12 +98,12 @@ class Bridge {
|
||||
}
|
||||
}
|
||||
|
||||
reloadFrontend() {
|
||||
async reloadFrontend() {
|
||||
const apiVersion = this.getFrontendApiVersion();
|
||||
|
||||
debug('reload frontend', apiVersion);
|
||||
const siteApp = require('./frontend/web/site');
|
||||
siteApp.reload({apiVersion});
|
||||
await siteApp.reload({apiVersion});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ module.exports = {
|
||||
if (labs.isSet('customThemeSettings')) {
|
||||
await customThemeSettings.api.activateTheme(themeName, checkedTheme);
|
||||
}
|
||||
bridge.activateTheme(theme, checkedTheme);
|
||||
await bridge.activateTheme(theme, checkedTheme);
|
||||
},
|
||||
activateFromAPI: async (themeName, theme, checkedTheme) => {
|
||||
debug('Activating theme (method B on API "activate")', themeName);
|
||||
@ -22,7 +22,7 @@ module.exports = {
|
||||
if (labs.isSet('customThemeSettings')) {
|
||||
await customThemeSettings.api.activateTheme(themeName, checkedTheme);
|
||||
}
|
||||
bridge.activateTheme(theme, checkedTheme);
|
||||
await bridge.activateTheme(theme, checkedTheme);
|
||||
},
|
||||
activateFromAPIOverride: async (themeName, theme, checkedTheme) => {
|
||||
debug('Activating theme (method C on API "override")', themeName);
|
||||
@ -30,6 +30,6 @@ module.exports = {
|
||||
if (labs.isSet('customThemeSettings')) {
|
||||
await customThemeSettings.api.activateTheme(themeName, checkedTheme);
|
||||
}
|
||||
bridge.activateTheme(theme, checkedTheme);
|
||||
await bridge.activateTheme(theme, checkedTheme);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user