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
235b3bef
Unverified
Commit
235b3bef
authored
May 26, 2020
by
Fabio Benedetti
Committed by
GitHub
May 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(client-routing): page render (#13305)
Fixes
https://github.com/zeit/next.js/issues/12935
parent
7bd52b8d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
4 deletions
+13
-4
next-serverless-loader.ts
...ages/next/build/webpack/loaders/next-serverless-loader.ts
+2
-1
next-server.ts
packages/next/next-server/server/next-server.ts
+1
-0
render.tsx
packages/next/next-server/server/render.tsx
+1
-1
index.js
test/integration/getserversideprops/pages/index.js
+9
-2
No files found.
packages/next/build/webpack/loaders/next-serverless-loader.ts
View file @
235b3bef
...
@@ -290,7 +290,8 @@ const nextServerlessLoader: loader.Loader = function () {
...
@@ -290,7 +290,8 @@ const nextServerlessLoader: loader.Loader = function () {
{
{
Component,
Component,
pageConfig: config,
pageConfig: config,
nextExport: fromExport
nextExport: fromExport,
isDataReq: _nextData,
},
},
options,
options,
)
)
...
...
packages/next/next-server/server/next-server.ts
View file @
235b3bef
...
@@ -1049,6 +1049,7 @@ export default class Server {
...
@@ -1049,6 +1049,7 @@ export default class Server {
const
renderOpts
:
RenderOpts
=
{
const
renderOpts
:
RenderOpts
=
{
...
components
,
...
components
,
...
opts
,
...
opts
,
isDataReq
,
}
}
renderResult
=
await
renderToHTML
(
req
,
res
,
pathname
,
query
,
renderOpts
)
renderResult
=
await
renderToHTML
(
req
,
res
,
pathname
,
query
,
renderOpts
)
...
...
packages/next/next-server/server/render.tsx
View file @
235b3bef
...
@@ -666,7 +666,7 @@ export async function renderToHTML(
...
@@ -666,7 +666,7 @@ export async function renderToHTML(
// We only need to do this if we want to support calling
// We only need to do this if we want to support calling
// _app's getInitialProps for getServerSideProps if not this can be removed
// _app's getInitialProps for getServerSideProps if not this can be removed
if
(
isDataReq
)
return
props
if
(
isDataReq
&&
!
isSSG
)
return
props
// We don't call getStaticProps or getServerSideProps while generating
// We don't call getStaticProps or getServerSideProps while generating
// the fallback so make sure to set pageProps to an empty object
// the fallback so make sure to set pageProps to an empty object
...
...
test/integration/getserversideprops/pages/index.js
View file @
235b3bef
import
Link
from
'next/link'
import
Link
from
'next/link'
export
async
function
getServerSideProps
()
{
export
async
function
getServerSideProps
(
{
req
}
)
{
return
{
return
{
props
:
{
props
:
{
url
:
req
.
url
,
world
:
'world'
,
world
:
'world'
,
time
:
new
Date
().
getTime
(),
time
:
new
Date
().
getTime
(),
},
},
}
}
}
}
const
Page
=
({
world
,
time
})
=>
{
const
Page
=
({
world
,
time
,
url
})
=>
{
if
(
typeof
window
===
'undefined'
)
{
if
(
url
.
startsWith
(
'/_next/data/'
))
{
throw
new
Error
(
'invalid render for data request'
)
}
}
return
(
return
(
<>
<>
<
p
>
hello
{
world
}
<
/p
>
<
p
>
hello
{
world
}
<
/p
>
...
...
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