File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/modules/remote-config/plugins Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,18 @@ export async function fetchRemoteConfig<T extends keyof RemoteConfig>(
3333
3434let remoteConfig : RemoteConfig | undefined ;
3535
36+ function isEmptyConfig ( maybeConfig : Partial < RemoteConfig > ) {
37+ if ( ! maybeConfig ) {
38+ return true ;
39+ }
40+ for ( const knownKey of knownKeys ) {
41+ if ( knownKey in maybeConfig ) {
42+ return false ;
43+ }
44+ }
45+ return true ;
46+ }
47+
3648const REFRESH_RATE = 1000 * 60 * 5 ;
3749
3850export const firebase : ConfigPlugin & { refresh ( ) : void } = {
@@ -62,7 +74,10 @@ export const firebase: ConfigPlugin & { refresh(): void } = {
6274 * By doing this, we make the remoteConfig "eventually up-to-date"
6375 */
6476 firebase . refresh ( ) ;
65- const config = remoteConfig ?? defaultConfig ;
77+ const config =
78+ remoteConfig && ! isEmptyConfig ( remoteConfig )
79+ ? remoteConfig
80+ : defaultConfig ;
6681 const value = config [ key ] ;
6782 return { value } ;
6883 } ,
You can’t perform that action at this time.
0 commit comments