From cdce233ba1b4b9c09cc62b8a12cd3da21c8ee35e Mon Sep 17 00:00:00 2001
From: James Daniels <jamesdaniels@google.com>
Date: Fri, 17 Jan 2020 14:23:28 -0800
Subject: [PATCH] fix(rc): Need to ensureInitialized()

---
 src/remote-config/remote-config.ts | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/remote-config/remote-config.ts b/src/remote-config/remote-config.ts
index 648e19c28..a20121bc6 100644
--- a/src/remote-config/remote-config.ts
+++ b/src/remote-config/remote-config.ts
@@ -108,12 +108,20 @@ export class AngularFireRemoteConfig {
     );
 
     const existing$ = loadedRemoteConfig$.pipe(
-      switchMap(rc => rc.activate().then(() => rc.getAll())),
+      switchMap(rc =>
+        rc.activate()
+          .then(() => rc.ensureInitialized())
+          .then(() => rc.getAll())
+      ),
       filterOutDefaults
     );
 
     const fresh$ = loadedRemoteConfig$.pipe(
-      switchMap(rc => zone.runOutsideAngular(() => rc.fetchAndActivate().then(() => rc.getAll()))),
+      switchMap(rc => zone.runOutsideAngular(() =>
+        rc.fetchAndActivate()
+          .then(() => rc.ensureInitialized())
+          .then(() => rc.getAll())
+      )),
       filterOutDefaults
     );