Skip to content

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

Refactor history entry limits

Andrew Bastin46ebd4993659
diff --git a/helpers/fb.js b/helpers/fb.js
index e09ea1cb0..5d8a1f8a2 100644
--- a/helpers/fb.js
+++ b/helpers/fb.js
@@ -8,6 +8,7 @@ import {
setRESTHistoryEntries,
graphqlHistoryStore,
setGraphqlHistoryEntries,
+ HISTORY_LIMIT,
} from "~/newstore/history"
// Initialize Firebase, copied from cloud console
@@ -22,9 +23,6 @@ const firebaseConfig = {
measurementId: process.env.MEASUREMENT_ID,
}
-const HISTORY_LIMIT = 50
-const GQL_HISTORY_LIMIT = 50
-
export const authProviders = {
google: () => new firebase.auth.GoogleAuthProvider(),
github: () => new firebase.auth.GithubAuthProvider(),
@@ -197,7 +195,7 @@ export class FirebaseInstance {
.doc(this.currentUser.uid)
.collection("graphqlHistory")
.orderBy("updatedOn", "desc")
- .limit(GQL_HISTORY_LIMIT)
+ .limit(HISTORY_LIMIT)
.onSnapshot((historyRef) => {
const history = []
diff --git a/newstore/history.ts b/newstore/history.ts
index dbaf9e62e..e88c02d83 100644
--- a/newstore/history.ts
+++ b/newstore/history.ts
@@ -10,7 +10,7 @@ export const defaultGraphqlHistoryState = {
state: [] as any[],
}
-const HISTORY_LIMIT = 50
+export const HISTORY_LIMIT = 50
type RESTHistoryType = typeof defaultRESTHistoryState
type GraphqlHistoryType = typeof defaultGraphqlHistoryState