Skip to content

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

chore: use IDs instead of Strings in graphql queries (#2961)

Akash Kc3c3fc672034
diff --git a/packages/hoppscotch-common/src/helpers/backend/gql/queries/GetCollectionChildren.graphql b/packages/hoppscotch-common/src/helpers/backend/gql/queries/GetCollectionChildren.graphql
index 0dac0aa74..b86f38e47 100644
--- a/packages/hoppscotch-common/src/helpers/backend/gql/queries/GetCollectionChildren.graphql
+++ b/packages/hoppscotch-common/src/helpers/backend/gql/queries/GetCollectionChildren.graphql
@@ -1,4 +1,4 @@
-query GetCollectionChildren($collectionID: ID!, $cursor: String) {
+query GetCollectionChildren($collectionID: ID!, $cursor: ID) {
collection(collectionID: $collectionID) {
children(cursor: $cursor) {
id
diff --git a/packages/hoppscotch-common/src/helpers/backend/gql/queries/GetCollectionChildrenIDs.graphql b/packages/hoppscotch-common/src/helpers/backend/gql/queries/GetCollectionChildrenIDs.graphql
index 67299f0f9..500677d63 100644
--- a/packages/hoppscotch-common/src/helpers/backend/gql/queries/GetCollectionChildrenIDs.graphql
+++ b/packages/hoppscotch-common/src/helpers/backend/gql/queries/GetCollectionChildrenIDs.graphql
@@ -1,4 +1,4 @@
-query GetCollectionChildrenIDs($collectionID: ID!, $cursor: String) {
+query GetCollectionChildrenIDs($collectionID: ID!, $cursor: ID) {
collection(collectionID: $collectionID) {
children(cursor: $cursor) {
id
diff --git a/packages/hoppscotch-web/src/firebase/init.ts b/packages/hoppscotch-web/src/firebase/init.ts
new file mode 100644
index 000000000..854dd1d58
--- /dev/null
+++ b/packages/hoppscotch-web/src/firebase/init.ts
@@ -0,0 +1,26 @@
+import { initializeApp } from "firebase/app"
+
+const firebaseConfig = {
+ apiKey: import.meta.env.VITE_API_KEY,
+ authDomain: import.meta.env.VITE_AUTH_DOMAIN,
+ databaseURL: import.meta.env.VITE_DATABASE_URL,
+ projectId: import.meta.env.VITE_PROJECT_ID,
+ storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
+ messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
+ appId: import.meta.env.VITE_APP_ID,
+ measurementId: import.meta.env.VITE_MEASUREMENT_ID,
+}
+
+let initialized = false
+
+export function initializeFirebase() {
+ if (!initialized) {
+ try {
+ initializeApp(firebaseConfig)
+ initialized = true
+ } catch (e) {
+ // initializeApp throws exception if we reinitialize
+ initialized = true
+ }
+ }
+}
diff --git a/packages/hoppscotch-web/src/main.ts b/packages/hoppscotch-web/src/main.ts
index 266b5a6ab..5e2108199 100644
--- a/packages/hoppscotch-web/src/main.ts
+++ b/packages/hoppscotch-web/src/main.ts
@@ -1,4 +1,5 @@
import { createHoppApp } from "@hoppscotch/common"
+import { initializeFirebase } from "./firebase/init"
import { def as authDef } from "./firebase/auth"
import { def as envDef } from "./environments"
import { def as collectionsDef } from "./collections"
@@ -7,6 +8,8 @@ import { def as historyDef } from "./history"
import { def as tabStateDef } from "./tab"
import { def as analyticsDef } from "./analytics"
+initializeFirebase()
+
createHoppApp("#app", {
auth: authDef,
analytics: analyticsDef,