Skip to content

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

fix: request variable list item remove bug (#4392)

Nivedin1a7860035fad
diff --git a/packages/hoppscotch-common/src/components/collections/Collection.vue b/packages/hoppscotch-common/src/components/collections/Collection.vue
index d0e8052f9..4fb467ab0 100644
--- a/packages/hoppscotch-common/src/components/collections/Collection.vue
+++ b/packages/hoppscotch-common/src/components/collections/Collection.vue
@@ -243,7 +243,6 @@ import {
changeCurrentReorderStatus,
currentReorderingStatus$,
} from "~/newstore/reordering"
-import { platform } from "~/platform"
import IconCheckCircle from "~icons/lucide/check-circle"
import IconCopy from "~icons/lucide/copy"
import IconDownload from "~icons/lucide/download"
@@ -334,11 +333,6 @@ const currentReorderingStatus = useReadonlyStream(currentReorderingStatus$, {
parentID: "",
})
-const currentUser = useReadonlyStream(
- platform.auth.getCurrentUserStream(),
- platform.auth.getCurrentUser()
-)
-
// Used to determine if the collection is being dragged to a different destination
// This is used to make the highlight effect work
watch(
diff --git a/packages/hoppscotch-common/src/components/collections/graphql/Collection.vue b/packages/hoppscotch-common/src/components/collections/graphql/Collection.vue
index c42a3c723..c3466461a 100644
--- a/packages/hoppscotch-common/src/components/collections/graphql/Collection.vue
+++ b/packages/hoppscotch-common/src/components/collections/graphql/Collection.vue
@@ -253,10 +253,8 @@ import { useToast } from "@composables/toast"
import { HoppCollection } from "@hoppscotch/data"
import { useService } from "dioc/vue"
import { computed, ref } from "vue"
-import { useReadonlyStream } from "~/composables/stream"
import { Picked } from "~/helpers/types/HoppPicked"
import { removeGraphqlCollection } from "~/newstore/collections"
-import { platform } from "~/platform"
import { GQLTabService } from "~/services/tab/graphql"
import IconCheckCircle from "~icons/lucide/check-circle"
import IconCopy from "~icons/lucide/copy"
@@ -333,11 +331,6 @@ const dragging = ref(false)
const confirmRemove = ref(false)
-const currentUser = useReadonlyStream(
- platform.auth.getCurrentUserStream(),
- platform.auth.getCurrentUser()
-)
-
const isSelected = computed(
() =>
props.picked?.pickedType === "gql-my-collection" &&
diff --git a/packages/hoppscotch-common/src/components/collections/graphql/Folder.vue b/packages/hoppscotch-common/src/components/collections/graphql/Folder.vue
index 3e26b77b9..552603fee 100644
--- a/packages/hoppscotch-common/src/components/collections/graphql/Folder.vue
+++ b/packages/hoppscotch-common/src/components/collections/graphql/Folder.vue
@@ -237,10 +237,8 @@ import { useToast } from "@composables/toast"
import { HoppCollection } from "@hoppscotch/data"
import { useService } from "dioc/vue"
import { computed, ref } from "vue"
-import { useReadonlyStream } from "~/composables/stream"
import { Picked } from "~/helpers/types/HoppPicked"
import { removeGraphqlFolder } from "~/newstore/collections"
-import { platform } from "~/platform"
import { GQLTabService } from "~/services/tab/graphql"
import IconCheckCircle from "~icons/lucide/check-circle"
import IconCopy from "~icons/lucide/copy"
@@ -297,11 +295,6 @@ const showChildren = ref(false)
const dragging = ref(false)
const confirmRemove = ref(false)
-const currentUser = useReadonlyStream(
- platform.auth.getCurrentUserStream(),
- platform.auth.getCurrentUser()
-)
-
const isSelected = computed(
() =>
props.picked?.pickedType === "gql-my-folder" &&
diff --git a/packages/hoppscotch-common/src/components/http/RequestVariables.vue b/packages/hoppscotch-common/src/components/http/RequestVariables.vue
index 3343a8634..9d8dab35e 100644
--- a/packages/hoppscotch-common/src/components/http/RequestVariables.vue
+++ b/packages/hoppscotch-common/src/components/http/RequestVariables.vue
@@ -251,6 +251,21 @@ const workingRequestVariables = ref<
},
])
+// Rule: Working Request variable always have last element is always an empty param
+watch(workingRequestVariables, (variableList) => {
+ if (
+ variableList.length > 0 &&
+ variableList[variableList.length - 1].key !== ""
+ ) {
+ workingRequestVariables.value.push({
+ id: idTicker.value++,
+ key: "",
+ value: "",
+ active: true,
+ })
+ }
+})
+
// Sync logic between params and working/bulk params
watch(
requestVariables,
@@ -324,21 +339,6 @@ watch(bulkVariables, (newBulkParams) => {
}
})
-// Rule: Working Request variable always have last element is always an empty param
-watch(workingRequestVariables, (variableList) => {
- if (
- variableList.length > 0 &&
- variableList[variableList.length - 1].key !== ""
- ) {
- workingRequestVariables.value.push({
- id: idTicker.value++,
- key: "",
- value: "",
- active: true,
- })
- }
-})
-
const addVariable = () => {
workingRequestVariables.value.push({
id: idTicker.value++,