We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28bc4d3 commit 0e2b0a1Copy full SHA for 0e2b0a1
src/store/api.js
@@ -2,7 +2,9 @@
2
import api from 'create-api'
3
4
// warm the front page cache every 15 min
5
-if (api.cachedIds) {
+// make sure to do this only once across all requests
6
+if (api.onServer && !api.warmCacheStarted) {
7
+ api.warmCacheStarted = true
8
warmCache()
9
}
10
src/store/create-api-server.js
@@ -1,5 +1,6 @@
1
import Firebase from 'firebase'
import LRU from 'lru-cache'
+import { fetchItems } from './api'
let api
const config = {
@@ -12,6 +13,7 @@ if (process.__API__) {
12
13
} else {
14
Firebase.initializeApp(config)
15
api = process.__API__ = Firebase.database().ref(version)
16
+ api.onServer = true
17
18
// fetched item cache
19
api.cachedItems = LRU({
0 commit comments