fix: reactivity issues

This commit is contained in:
Andrew Bastin
2021-12-12 20:36:49 +05:30
parent 534fe8030f
commit fe5fe03b3c
5 changed files with 235 additions and 165 deletions

View File

@@ -285,7 +285,7 @@ export const currentEnvironment$ = combineLatest([
})
)
type AggregateEnvironment = {
export type AggregateEnvironment = {
key: string
value: string
sourceEnv: string
@@ -314,6 +314,29 @@ export const aggregateEnvs$: Observable<AggregateEnvironment[]> = combineLatest(
distinctUntilChanged(isEqual)
)
export function getAggregateEnvs() {
const currentEnv = getCurrentEnvironment()
return [
...currentEnv.variables.map(
(x) =>
<AggregateEnvironment>{
key: x.key,
value: x.value,
sourceEnv: currentEnv.name,
}
),
...getGlobalVariables().map(
(x) =>
<AggregateEnvironment>{
key: x.key,
value: x.value,
sourceEnv: "Global",
}
),
]
}
export function getCurrentEnvironment(): Environment {
if (environmentsStore.value.currentEnvironmentIndex === -1) {
return {