Skip to content

Commit 7f759c8

Browse files
committed
fix
1 parent b010721 commit 7f759c8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Config.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ function removeTrailingSlash(str) {
3232
return str;
3333
}
3434

35+
/**
36+
* Config keys that need to be loaded asynchronously.
37+
*/
3538
const asyncKeys = ['publicServerURL'];
39+
3640
export class Config {
3741
static get(applicationId: string, mount: string) {
3842
const cacheInfo = AppCache.get(applicationId);
@@ -58,8 +62,6 @@ export class Config {
5862
}
5963

6064
async loadKeys() {
61-
const asyncKeys = ['publicServerURL'];
62-
6365
await Promise.all(
6466
asyncKeys.map(async key => {
6567
if (typeof this[`_${key}`] === 'function') {
@@ -68,7 +70,14 @@ export class Config {
6870
})
6971
);
7072

71-
AppCache.put(this.appId, this);
73+
const cachedConfig = AppCache.get(this.appId);
74+
if (cachedConfig) {
75+
const updatedConfig = { ...cachedConfig };
76+
asyncKeys.forEach(key => {
77+
updatedConfig[key] = this[key];
78+
});
79+
AppCache.put(this.appId, updatedConfig);
80+
}
7281
}
7382

7483
static transformConfiguration(serverConfiguration) {

0 commit comments

Comments
 (0)