From 46ebd49936598797d094cd820159df2852ccad07 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 24 May 2021 22:13:50 -0400 Subject: [PATCH] Refactor history entry limits --- helpers/fb.js | 6 ++---- newstore/history.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) 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