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: tab systems erroring out due to out of sync tabOrdering and tabMap

Andrew Bastin426e7594f42a
diff --git a/packages/hoppscotch-common/src/services/tab/graphql.ts b/packages/hoppscotch-common/src/services/tab/graphql.ts
index f220b4d7e..afaa257ad 100644
--- a/packages/hoppscotch-common/src/services/tab/graphql.ts
+++ b/packages/hoppscotch-common/src/services/tab/graphql.ts
@@ -3,11 +3,16 @@ import { getDefaultGQLRequest } from "~/helpers/graphql/default"
import { HoppGQLDocument, HoppGQLSaveContext } from "~/helpers/graphql/document"
import { TabService } from "./tab"
import { computed } from "vue"
+import { Container } from "dioc"
export class GQLTabService extends TabService<HoppGQLDocument> {
public static readonly ID = "GQL_TAB_SERVICE"
- override onServiceInit() {
+ // TODO: Moving this to `onServiceInit` breaks `persistableTabState`
+ // Figure out how to fix this
+ constructor(c: Container) {
+ super(c)
+
this.tabMap.set("test", {
id: "test",
document: {
diff --git a/packages/hoppscotch-common/src/services/tab/rest.ts b/packages/hoppscotch-common/src/services/tab/rest.ts
index 604fc1217..29323a730 100644
--- a/packages/hoppscotch-common/src/services/tab/rest.ts
+++ b/packages/hoppscotch-common/src/services/tab/rest.ts
@@ -3,11 +3,16 @@ import { computed } from "vue"
import { getDefaultRESTRequest } from "~/helpers/rest/default"
import { HoppRESTDocument, HoppRESTSaveContext } from "~/helpers/rest/document"
import { TabService } from "./tab"
+import { Container } from "dioc"
export class RESTTabService extends TabService<HoppRESTDocument> {
public static readonly ID = "REST_TAB_SERVICE"
- override onServiceInit() {
+ // TODO: Moving this to `onServiceInit` breaks `persistableTabState`
+ // Figure out how to fix this
+ constructor(c: Container) {
+ super(c)
+
this.tabMap.set("test", {
id: "test",
document: {