Unverified Commit d24eeb64 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix only generated case in minimal mode (#36130)

parent bc40c0b5
...@@ -1449,7 +1449,12 @@ export default abstract class Server { ...@@ -1449,7 +1449,12 @@ export default abstract class Server {
// skip manual revalidate if cache is not present and // skip manual revalidate if cache is not present and
// revalidate-if-generated is set // revalidate-if-generated is set
if (isManualRevalidate && revalidateOnlyGenerated && !hadCache) { if (
isManualRevalidate &&
revalidateOnlyGenerated &&
!hadCache &&
!this.minimalMode
) {
await this.render404(req, res) await this.render404(req, res)
return null return null
} }
......
...@@ -235,6 +235,25 @@ describe('should set-up next', () => { ...@@ -235,6 +235,25 @@ describe('should set-up next', () => {
expect(props2.gspCalls).not.toBe(props.gspCalls) expect(props2.gspCalls).not.toBe(props.gspCalls)
}) })
it('should not 404 for onlyGenerated manual revalidate in minimal mode', async () => {
const previewProps = JSON.parse(
await next.readFile('standalone/.next/prerender-manifest.json')
).preview
const res = await fetchViaHTTP(
appPort,
'/optional-ssg/only-generated-1',
undefined,
{
headers: {
'x-prerender-revalidate': previewProps.previewModeId,
'x-prerender-revalidate-if-generated': '1',
},
}
)
expect(res.status).toBe(200)
})
it('should set correct SWR headers with notFound gsp', async () => { it('should set correct SWR headers with notFound gsp', async () => {
await waitFor(2000) await waitFor(2000)
await next.patchFile('standalone/data.txt', 'show') await next.patchFile('standalone/data.txt', 'show')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment