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

This commit is contained in:
Nivedin
2024-10-01 14:12:29 +05:30
committed by GitHub
parent dcdcdeb1db
commit 1a7860035f
4 changed files with 15 additions and 35 deletions

View File

@@ -243,7 +243,6 @@ import {
changeCurrentReorderStatus, changeCurrentReorderStatus,
currentReorderingStatus$, currentReorderingStatus$,
} from "~/newstore/reordering" } from "~/newstore/reordering"
import { platform } from "~/platform"
import IconCheckCircle from "~icons/lucide/check-circle" import IconCheckCircle from "~icons/lucide/check-circle"
import IconCopy from "~icons/lucide/copy" import IconCopy from "~icons/lucide/copy"
import IconDownload from "~icons/lucide/download" import IconDownload from "~icons/lucide/download"
@@ -334,11 +333,6 @@ const currentReorderingStatus = useReadonlyStream(currentReorderingStatus$, {
parentID: "", parentID: "",
}) })
const currentUser = useReadonlyStream(
platform.auth.getCurrentUserStream(),
platform.auth.getCurrentUser()
)
// Used to determine if the collection is being dragged to a different destination // Used to determine if the collection is being dragged to a different destination
// This is used to make the highlight effect work // This is used to make the highlight effect work
watch( watch(

View File

@@ -253,10 +253,8 @@ import { useToast } from "@composables/toast"
import { HoppCollection } from "@hoppscotch/data" import { HoppCollection } from "@hoppscotch/data"
import { useService } from "dioc/vue" import { useService } from "dioc/vue"
import { computed, ref } from "vue" import { computed, ref } from "vue"
import { useReadonlyStream } from "~/composables/stream"
import { Picked } from "~/helpers/types/HoppPicked" import { Picked } from "~/helpers/types/HoppPicked"
import { removeGraphqlCollection } from "~/newstore/collections" import { removeGraphqlCollection } from "~/newstore/collections"
import { platform } from "~/platform"
import { GQLTabService } from "~/services/tab/graphql" import { GQLTabService } from "~/services/tab/graphql"
import IconCheckCircle from "~icons/lucide/check-circle" import IconCheckCircle from "~icons/lucide/check-circle"
import IconCopy from "~icons/lucide/copy" import IconCopy from "~icons/lucide/copy"
@@ -333,11 +331,6 @@ const dragging = ref(false)
const confirmRemove = ref(false) const confirmRemove = ref(false)
const currentUser = useReadonlyStream(
platform.auth.getCurrentUserStream(),
platform.auth.getCurrentUser()
)
const isSelected = computed( const isSelected = computed(
() => () =>
props.picked?.pickedType === "gql-my-collection" && props.picked?.pickedType === "gql-my-collection" &&

View File

@@ -237,10 +237,8 @@ import { useToast } from "@composables/toast"
import { HoppCollection } from "@hoppscotch/data" import { HoppCollection } from "@hoppscotch/data"
import { useService } from "dioc/vue" import { useService } from "dioc/vue"
import { computed, ref } from "vue" import { computed, ref } from "vue"
import { useReadonlyStream } from "~/composables/stream"
import { Picked } from "~/helpers/types/HoppPicked" import { Picked } from "~/helpers/types/HoppPicked"
import { removeGraphqlFolder } from "~/newstore/collections" import { removeGraphqlFolder } from "~/newstore/collections"
import { platform } from "~/platform"
import { GQLTabService } from "~/services/tab/graphql" import { GQLTabService } from "~/services/tab/graphql"
import IconCheckCircle from "~icons/lucide/check-circle" import IconCheckCircle from "~icons/lucide/check-circle"
import IconCopy from "~icons/lucide/copy" import IconCopy from "~icons/lucide/copy"
@@ -297,11 +295,6 @@ const showChildren = ref(false)
const dragging = ref(false) const dragging = ref(false)
const confirmRemove = ref(false) const confirmRemove = ref(false)
const currentUser = useReadonlyStream(
platform.auth.getCurrentUserStream(),
platform.auth.getCurrentUser()
)
const isSelected = computed( const isSelected = computed(
() => () =>
props.picked?.pickedType === "gql-my-folder" && props.picked?.pickedType === "gql-my-folder" &&

View File

@@ -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 // Sync logic between params and working/bulk params
watch( watch(
requestVariables, 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 = () => { const addVariable = () => {
workingRequestVariables.value.push({ workingRequestVariables.value.push({
id: idTicker.value++, id: idTicker.value++,