Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix only generated case in minimal mode #36130

Merged
merged 1 commit into from Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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