Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
3adaafe7
Unverified
Commit
3adaafe7
authored
May 22, 2019
by
JJ Kasper
Committed by
GitHub
May 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure rendering behavior is only changed when autoExport is enabled (#7408)
parent
b6d3c1fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
next-server.ts
packages/next-server/server/next-server.ts
+2
-0
render.tsx
packages/next-server/server/render.tsx
+10
-6
No files found.
packages/next-server/server/next-server.ts
View file @
3adaafe7
...
...
@@ -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
,
...
...
packages/next-server/server/render.tsx
View file @
3adaafe7
...
...
@@ -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
,
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment