Skip to content

Commit 17e5074

Browse files
authored
feat: implement page router cache set and get (#44)
* feat: implement page router cache set and get * chore: make the assertions more verbose
1 parent 11693c8 commit 17e5074

File tree

20 files changed

+1231
-105
lines changed

20 files changed

+1231
-105
lines changed

src/run/handlers/cache.cts

+5-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type { CacheEntryValue } from '../../build/content/prerendered.js'
1515

1616
type TagManifest = { revalidatedAt: number }
1717

18-
const tagsManifestPath = '_netlify-cache/tags'
18+
const tagsManifestPath = '.netlfiy/cache/tags'
1919
const blobStore = getDeployStore()
2020

2121
// load the prerender manifest
@@ -69,13 +69,7 @@ export default class NetlifyCacheHandler implements CacheHandler {
6969
case 'PAGE':
7070
return {
7171
lastModified: blob.lastModified,
72-
value: {
73-
kind: 'PAGE',
74-
html: blob.value.html,
75-
pageData: blob.value.pageData,
76-
headers: blob.value.headers,
77-
status: blob.value.status,
78-
},
72+
value: blob.value,
7973
}
8074

8175
// default:
@@ -93,7 +87,8 @@ export default class NetlifyCacheHandler implements CacheHandler {
9387
cacheKey = join('cache/fetch-cache', key)
9488
break
9589
case 'PAGE':
96-
cacheKey = join('server/app', key)
90+
cacheKey =
91+
typeof data.pageData === 'string' ? join('server/app', key) : join('server/pages', key)
9792
break
9893
default:
9994
console.debug(`TODO: implement NetlifyCacheHandler.set for ${key}`, { data, ctx })
@@ -168,7 +163,7 @@ export default class NetlifyCacheHandler implements CacheHandler {
168163
])
169164

170165
// just get the first item out of it that is defined (either the pageRoute or the appRoute)
171-
const [cacheEntry] = values.filter(({ value }) => !!value)
166+
const [cacheEntry] = values.filter((keys) => keys && !!keys.value)
172167

173168
// TODO: set the cache tags based on the tag manifest once we have that
174169
// if (cacheEntry) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
output: 'standalone',
4+
eslint: {
5+
ignoreDuringBuilds: true,
6+
},
7+
}
8+
9+
module.exports = nextConfig

0 commit comments

Comments
 (0)