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

Clean up landed experimental flags #10593

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cbfac04
Clean up landed experimental flags
timneutkens Feb 19, 2020
9ee3710
Remove check for experimental flags from build too
timneutkens Feb 19, 2020
758fef9
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
940ecfa
Merge branch 'fix/remove-landed-experimental-options' of github.com:t…
timneutkens Feb 19, 2020
63baa82
Remove /_errors/404 in favor of /404
timneutkens Feb 19, 2020
2d7e0fc
Remove unneeded check for pathname
timneutkens Feb 19, 2020
c4149fd
Update test paths
timneutkens Feb 19, 2020
8bee4e4
Fix test
timneutkens Feb 19, 2020
403982c
Update test
timneutkens Feb 19, 2020
7949c20
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
ac869bd
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
f9bfc3d
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
65ed154
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
d94eae3
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
778f764
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
554771a
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
e508246
Remove test for disabled config
timneutkens Feb 19, 2020
ea38c54
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
2964ba9
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
58e6678
Merge branch 'canary' into fix/remove-landed-experimental-options
Timer Feb 19, 2020
fcbe670
Merge branch 'fix/remove-landed-experimental-options' of github.com:t…
timneutkens Feb 19, 2020
9dd7d30
Set pages404 always to true
timneutkens Feb 19, 2020
15216b4
Merge branch 'canary' into fix/remove-landed-experimental-options
ijjk Feb 19, 2020
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
2 changes: 0 additions & 2 deletions packages/next/next-server/server/config.ts
Expand Up @@ -52,8 +52,6 @@ const defaultConfig: { [key: string]: any } = {
reactMode: 'legacy',
workerThreads: false,
basePath: '',
static404: true,
pages404: true,
},
future: {
excludeDefaultMomentLocales: false,
Expand Down
11 changes: 3 additions & 8 deletions packages/next/next-server/server/next-server.ts
Expand Up @@ -114,7 +114,6 @@ export default class Server {
documentMiddlewareEnabled: boolean
hasCssMode: boolean
dev?: boolean
pages404?: boolean
}
private compression?: Middleware
private onErrorMiddleware?: ({ err }: { err: Error }) => Promise<void>
Expand Down Expand Up @@ -162,7 +161,6 @@ export default class Server {
staticMarkup,
buildId: this.buildId,
generateEtags,
pages404: this.nextConfig.experimental.pages404,
}

// Only the `publicRuntimeConfig` key is exposed to the client side
Expand Down Expand Up @@ -866,7 +864,7 @@ export default class Server {
opts: any
): Promise<string | null> {
// we need to ensure the status code if /404 is visited directly
if (this.nextConfig.experimental.pages404 && pathname === '/404') {
if (pathname === '/404') {
res.statusCode = 404
}

Expand Down Expand Up @@ -1171,19 +1169,16 @@ export default class Server {
) {
let result: null | FindComponentsResult = null

const { static404, pages404 } = this.nextConfig.experimental
const is404 = res.statusCode === 404
let using404Page = false

// use static 404 page if available and is 404 response
if (is404) {
if (static404) {
result = await this.findPageComponents('/_errors/404')
}
result = await this.findPageComponents('/_errors/404')

// use 404 if /_errors/404 isn't available which occurs
// during development and when _app has getInitialProps
if (!result && pages404) {
if (!result) {
result = await this.findPageComponents('/404')
using404Page = result !== null
}
Expand Down
4 changes: 1 addition & 3 deletions packages/next/next-server/server/render.tsx
Expand Up @@ -145,7 +145,6 @@ type RenderOpts = LoadComponentsReturnType & {
documentMiddlewareEnabled?: boolean
isDataReq?: boolean
params?: ParsedUrlQuery
pages404?: boolean
previewProps: __ApiPreviewProps
}

Expand Down Expand Up @@ -278,7 +277,6 @@ export async function renderToHTML(
unstable_getServerProps,
isDataReq,
params,
pages404,
previewProps,
} = renderOpts

Expand Down Expand Up @@ -391,7 +389,7 @@ export async function renderToHTML(
renderOpts.nextExport = true
}

if (pages404 && pathname === '/404' && !isAutoExport) {
if (pathname === '/404' && !isAutoExport) {
throw new Error(PAGES_404_GET_INITIAL_PROPS_ERROR)
}
}
Expand Down