diff --git a/packages/hoppscotch-common/src/components/graphql/Sidebar.vue b/packages/hoppscotch-common/src/components/graphql/Sidebar.vue index 4019154a6..8d3def5f4 100644 --- a/packages/hoppscotch-common/src/components/graphql/Sidebar.vue +++ b/packages/hoppscotch-common/src/components/graphql/Sidebar.vue @@ -187,7 +187,7 @@ import IconClock from "~icons/lucide/clock" import IconCopy from "~icons/lucide/copy" import IconBox from "~icons/lucide/box" import { computed, nextTick, reactive, ref } from "vue" -import { GraphQLField, GraphQLType } from "graphql" +import { GraphQLField, GraphQLType, getNamedType } from "graphql" import { refAutoReset } from "@vueuse/core" import { useCodemirror } from "@composables/codemirror" import { copyToClipboard } from "@helpers/utils/clipboard" @@ -260,12 +260,6 @@ function getFilteredGraphqlTypes(filterText: string, types: GraphQLType[]) { }) } -function resolveRootType(type: GraphQLType) { - let t: any = type - while (t.ofType) t = t.ofType - return t -} - const toast = useToast() const downloadSchemaIcon = refAutoReset( @@ -331,7 +325,7 @@ const handleJumpToType = async (type: GraphQLType) => { selectedGqlTab.value = "types" await nextTick() - const rootTypeName = resolveRootType(type).name + const rootTypeName = getNamedType(type).name const target = document.getElementById(`type_${rootTypeName}`) if (target) { target.scrollIntoView({ block: "center", behavior: "smooth" }) diff --git a/packages/hoppscotch-common/src/components/graphql/TypeLink.vue b/packages/hoppscotch-common/src/components/graphql/TypeLink.vue index 6b4e1c885..8404dd045 100644 --- a/packages/hoppscotch-common/src/components/graphql/TypeLink.vue +++ b/packages/hoppscotch-common/src/components/graphql/TypeLink.vue @@ -8,7 +8,7 @@