File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff 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+ */
3538const asyncKeys = [ 'publicServerURL' ] ;
39+
3640export 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 ) {
You can’t perform that action at this time.
0 commit comments