-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore error pages for cache revalidate (#72412)
- Loading branch information
Showing
4 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
test/production/empty-ssg-fallback/empty-ssg-fallback.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
describe('empty-ssg-fallback', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should not cache 404 error page', async () => { | ||
const res = await next.fetch('/any-non-existed') | ||
expect(res.status).toBe(404) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const getStaticPaths = async () => { | ||
return { | ||
paths: [], | ||
fallback: 'blocking', | ||
} | ||
} | ||
export const getStaticProps = async () => { | ||
return { | ||
notFound: true, | ||
} | ||
} | ||
|
||
export default function Page() { | ||
return <p>slug</p> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { GetServerSidePropsContext } from 'next' | ||
|
||
function Error({ statusCode }: { statusCode: number }) { | ||
return <p>{statusCode ? `${statusCode} error` : '500 error'}</p> | ||
} | ||
|
||
export async function getServerSideProps({ res }: GetServerSidePropsContext) { | ||
const statusCode = res ? res.statusCode : 404 | ||
return { props: { statusCode } } | ||
} | ||
|
||
export default Error |