diff --git a/components/smart/EnvInput.vue b/components/smart/EnvInput.vue index fb2c08e95..75c8aa94e 100644 --- a/components/smart/EnvInput.vue +++ b/components/smart/EnvInput.vue @@ -124,8 +124,10 @@ export default defineComponent({ processHighlights() { if (!this.highlightEnabled) { this.htmlOutput = this.internalValue - this.$emit("input", this.internalValue) - this.$emit("change", this.internalValue) + if (this.intervalTree !== this.value) { + this.$emit("input", this.internalValue) + this.$emit("change", this.internalValue) + } return } @@ -223,8 +225,10 @@ export default defineComponent({ this.renderTippy() }) - this.$emit("input", this.internalValue) - this.$emit("change", this.internalValue) + if (this.internalValue !== this.value) { + this.$emit("input", this.internalValue) + this.$emit("change", this.internalValue) + } }, renderTippy() { const tippable = document.querySelectorAll("[v-tippy]") diff --git a/helpers/fb/environments.ts b/helpers/fb/environments.ts index 15b4a6005..19f82f064 100644 --- a/helpers/fb/environments.ts +++ b/helpers/fb/environments.ts @@ -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 }) } diff --git a/newstore/environments.ts b/newstore/environments.ts index 64c621122..5945c7816 100644 --- a/newstore/environments.ts +++ b/newstore/environments.ts @@ -1,5 +1,6 @@ +import { isEqual } from "lodash" import { combineLatest } from "rxjs" -import { map, pluck } from "rxjs/operators" +import { distinctUntilChanged, map, pluck } from "rxjs/operators" import DispatchingStore, { defineDispatchers, } from "~/newstore/DispatchingStore" @@ -232,13 +233,18 @@ export const environmentsStore = new DispatchingStore( ) export const environments$ = environmentsStore.subject$.pipe( - pluck("environments") + pluck("environments"), + distinctUntilChanged() ) -export const globalEnv$ = environmentsStore.subject$.pipe(pluck("globals")) +export const globalEnv$ = environmentsStore.subject$.pipe( + pluck("globals"), + distinctUntilChanged() +) export const selectedEnvIndex$ = environmentsStore.subject$.pipe( - pluck("currentEnvironmentIndex") + pluck("currentEnvironmentIndex"), + distinctUntilChanged() ) export const currentEnvironment$ = combineLatest([ @@ -279,7 +285,8 @@ export const aggregateEnvs$ = combineLatest([ ) return results - }) + }), + distinctUntilChanged(isEqual) ) export function getCurrentEnvironment(): Environment {