fix(common): use tab service within helpers (#3448)

This commit is contained in:
James George
2023-10-12 00:45:45 -07:00
committed by GitHub
parent ba31cdabea
commit 016a18d3b2

View File

@@ -1,5 +1,6 @@
import { GQLHeader, HoppGQLAuth, makeGQLRequest } from "@hoppscotch/data" import { GQLHeader, HoppGQLAuth, makeGQLRequest } from "@hoppscotch/data"
import { OperationType } from "@urql/core" import { OperationType } from "@urql/core"
import * as E from "fp-ts/Either"
import { import {
GraphQLEnumType, GraphQLEnumType,
GraphQLInputObjectType, GraphQLInputObjectType,
@@ -11,11 +12,12 @@ import {
printSchema, printSchema,
} from "graphql" } from "graphql"
import { computed, reactive, ref } from "vue" import { computed, reactive, ref } from "vue"
import { addGraphqlHistoryEntry, makeGQLHistoryEntry } from "~/newstore/history"
import { currentTabID } from "./tab"
import { getService } from "~/modules/dioc" import { getService } from "~/modules/dioc"
import { addGraphqlHistoryEntry, makeGQLHistoryEntry } from "~/newstore/history"
import { InterceptorService } from "~/services/interceptor.service" import { InterceptorService } from "~/services/interceptor.service"
import * as E from "fp-ts/Either" import { GQLTabService } from "~/services/tab/graphql"
const GQL_SCHEMA_POLL_INTERVAL = 7000 const GQL_SCHEMA_POLL_INTERVAL = 7000
@@ -61,6 +63,9 @@ type Connection = {
schema: GraphQLSchema | null schema: GraphQLSchema | null
} }
const tabs = getService(GQLTabService)
const currentTabID = computed(() => tabs.currentTabID.value)
export const connection = reactive<Connection>({ export const connection = reactive<Connection>({
state: "DISCONNECTED", state: "DISCONNECTED",
subscriptionState: new Map<string, SubscriptionState>(), subscriptionState: new Map<string, SubscriptionState>(),