Skip to content

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

feat: envinput revalidates with environment changes

Andrew Bastin6acb9be48cd6
diff --git a/components/smart/EnvInput.vue b/components/smart/EnvInput.vue
index ea76c435e..9edbc7516 100644
--- a/components/smart/EnvInput.vue
+++ b/components/smart/EnvInput.vue
@@ -26,7 +26,11 @@ import IntervalTree from "node-interval-tree"
import debounce from "lodash/debounce"
import isUndefined from "lodash/isUndefined"
import { tippy } from "vue-tippy"
-import { getCurrentEnvironment } from "~/newstore/environments"
+import {
+ currentEnvironment$,
+ getCurrentEnvironment,
+} from "~/newstore/environments"
+import { useReadonlyStream } from "~/helpers/utils/composables"
const tagsToReplace = {
"&": "&",
@@ -49,7 +53,16 @@ export default defineComponent({
default: "",
},
},
+ setup() {
+ const currentEnvironment = useReadonlyStream(
+ currentEnvironment$,
+ getCurrentEnvironment()
+ )
+ return {
+ currentEnvironment,
+ }
+ },
data() {
return {
internalValue: "",
@@ -70,6 +83,9 @@ export default defineComponent({
},
watch: {
+ currentEnvironment() {
+ this.processHighlights()
+ },
highlightStyle() {
this.processHighlights()
},