Unverified Commit 3adaafe7 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Make sure rendering behavior is only changed when autoExport is enabled (#7408)

parent b6d3c1fd
......@@ -48,6 +48,7 @@ export default class Server {
generateEtags: boolean
runtimeConfig?: { [key: string]: any }
assetPrefix?: string,
autoExport: boolean,
}
router: Router
......@@ -78,6 +79,7 @@ export default class Server {
this.renderOpts = {
ampBindInitData: this.nextConfig.experimental.ampBindInitData,
poweredByHeader: this.nextConfig.poweredByHeader,
autoExport: this.nextConfig.experimental.autoExport,
staticMarkup,
buildId: this.buildId,
generateEtags,
......
......@@ -109,6 +109,7 @@ function render(
}
type RenderOpts = {
autoExport: boolean
ampBindInitData: boolean
staticMarkup: boolean
buildId: string
......@@ -220,6 +221,7 @@ export async function renderToHTML(
const {
err,
dev = false,
autoExport = false,
ampBindInitData = false,
staticMarkup = false,
ampPath = '',
......@@ -253,13 +255,15 @@ export async function renderToHTML(
)
}
const isStaticPage = typeof (Component as any).getInitialProps !== 'function'
const defaultAppGetInitialProps = App.getInitialProps === (App as any).origGetInitialProps
if (autoExport) {
const isStaticPage = typeof (Component as any).getInitialProps !== 'function'
const defaultAppGetInitialProps = App.getInitialProps === (App as any).origGetInitialProps
if (isStaticPage && defaultAppGetInitialProps) {
// remove query values except ones that will be set during export
query = {
amp: query.amp,
if (isStaticPage && defaultAppGetInitialProps) {
// remove query values except ones that will be set during export
query = {
amp: query.amp,
}
}
}
}
......
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