Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Add firebase sync code for new environment state system

Andrew Bastin6ea9d16f8759
diff --git a/helpers/fb.js b/helpers/fb.js
index 730e25857..d0adde190 100644
--- a/helpers/fb.js
+++ b/helpers/fb.js
@@ -46,7 +46,6 @@ export class FirebaseInstance {
this.idToken = null
this.currentFeeds = []
this.currentSettings = []
- this.currentEnvironments = []
this.currentUser$ = new ReplaySubject(1)
this.idToken$ = new ReplaySubject(1)
@@ -56,7 +55,7 @@ export class FirebaseInstance {
let loadedGraphqlHistory = false
let loadedRESTCollections = false
let loadedGraphqlCollections = false
- const loadedEnvironments = false
+ let loadedEnvironments = false
graphqlCollectionStore.subject$.subscribe(({ state }) => {
if (
@@ -300,9 +299,10 @@ export class FirebaseInstance {
environment.id = doc.id
environments.push(environment)
})
- if (environments.length > 0) {
- this.currentEnvironments = environments[0].environment
- }
+
+ loadedEnvironments = false
+ replaceEnvironments(environments)
+ loadedEnvironments = true
})
} else {
this.currentUser = null