fix: environments being cringe :)

This commit is contained in:
Andrew Bastin
2021-08-21 10:38:35 +05:30
parent 77d876d443
commit c00c8f249e
3 changed files with 26 additions and 18 deletions

View File

@@ -141,17 +141,14 @@ export function initEnvironments() {
.doc(user.uid)
.collection("globalEnv")
.onSnapshot((globalsRef) => {
const variables: any[] = []
globalsRef.forEach((doc) => {
const variable = doc.data()
variable.id = doc.id
variables.push(variable)
})
if (globalsRef.docs.length === 0) {
loadedGlobals = true
return
}
const doc = globalsRef.docs[0].data()
loadedGlobals = false
setGlobalEnvVariables(variables)
setGlobalEnvVariables(doc.variables)
loadedGlobals = true
})
}