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: fix graphql history sync issue

Andrew Bastin503a54fc5ec8
diff --git a/packages/hoppscotch-app/helpers/fb/history.ts b/packages/hoppscotch-app/helpers/fb/history.ts
index cbaf5aeae..d7b1207b3 100644
--- a/packages/hoppscotch-app/helpers/fb/history.ts
+++ b/packages/hoppscotch-app/helpers/fb/history.ts
@@ -68,10 +68,13 @@ const purgeFormDataFromRequest = (req: RESTHistoryEntry): RESTHistoryEntry => {
}
async function writeHistory(
- entry: RESTHistoryEntry,
+ entry: RESTHistoryEntry | GQLHistoryEntry,
col: HistoryFBCollections
) {
- const processedEntry = purgeFormDataFromRequest(entry)
+ const processedEntry =
+ col === "history"
+ ? purgeFormDataFromRequest(entry as RESTHistoryEntry)
+ : entry
if (currentUser$.value == null)
throw new Error("User not logged in to sync history")
@@ -93,7 +96,7 @@ async function writeHistory(
}
async function deleteHistory(
- entry: RESTHistoryEntry & { id: string },
+ entry: (RESTHistoryEntry | GQLHistoryEntry) & { id: string },
col: HistoryFBCollections
) {
if (currentUser$.value == null)
@@ -120,7 +123,10 @@ async function clearHistory(col: HistoryFBCollections) {
await Promise.all(docs.map((e) => deleteHistory(e as any, col)))
}
-async function toggleStar(entry: any, col: HistoryFBCollections) {
+async function toggleStar(
+ entry: (RESTHistoryEntry | GQLHistoryEntry) & { id: string },
+ col: HistoryFBCollections
+) {
if (currentUser$.value == null)
throw new Error("User not logged in to toggle star")