Skip to content

Commit

Permalink
Fix only generated case in minimal mode (#36130)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Apr 13, 2022
1 parent bc40c0b commit d24eeb6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/next/server/base-server.ts
Expand Up @@ -1449,7 +1449,12 @@ export default abstract class Server {

// skip manual revalidate if cache is not present and
// revalidate-if-generated is set
if (isManualRevalidate && revalidateOnlyGenerated && !hadCache) {
if (
isManualRevalidate &&
revalidateOnlyGenerated &&
!hadCache &&
!this.minimalMode
) {
await this.render404(req, res)
return null
}
Expand Down
19 changes: 19 additions & 0 deletions test/production/required-server-files.test.ts
Expand Up @@ -235,6 +235,25 @@ describe('should set-up next', () => {
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 () => {
await waitFor(2000)
await next.patchFile('standalone/data.txt', 'show')
Expand Down

0 comments on commit d24eeb6

Please sign in to comment.