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
fcc4d8cd
Unverified
Commit
fcc4d8cd
authored
Aug 04, 2020
by
agstover
Committed by
GitHub
Aug 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
await ctx.renderPage() in examples for TypeScript (#15528)
Co-authored-by:
Joe Haddad
<
joe.haddad@zeit.co
>
parent
1968f7f5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
9 deletions
+8
-9
_document.js
examples/with-cxs/pages/_document.js
+1
-1
_document.js
examples/with-glamor/pages/_document.js
+1
-1
_document.js
examples/with-goober/pages/_document.js
+2
-3
_document.js
examples/with-react-native-web/pages/_document.js
+1
-1
_document.js
examples/with-tailwindcss-emotion/pages/_document.js
+1
-1
_document.js
examples/with-typestyle/pages/_document.js
+2
-2
No files found.
examples/with-cxs/pages/_document.js
View file @
fcc4d8cd
...
@@ -3,7 +3,7 @@ import cxs from 'cxs/lite'
...
@@ -3,7 +3,7 @@ import cxs from 'cxs/lite'
export
default
class
MyDocument
extends
Document
{
export
default
class
MyDocument
extends
Document
{
static
async
getInitialProps
({
renderPage
})
{
static
async
getInitialProps
({
renderPage
})
{
const
page
=
renderPage
()
const
page
=
await
renderPage
()
const
style
=
cxs
.
getCss
()
const
style
=
cxs
.
getCss
()
return
{
...
page
,
style
}
return
{
...
page
,
style
}
}
}
...
...
examples/with-glamor/pages/_document.js
View file @
fcc4d8cd
...
@@ -3,7 +3,7 @@ import { renderStatic } from 'glamor/server'
...
@@ -3,7 +3,7 @@ import { renderStatic } from 'glamor/server'
class
MyDocument
extends
Document
{
class
MyDocument
extends
Document
{
static
async
getInitialProps
({
renderPage
})
{
static
async
getInitialProps
({
renderPage
})
{
const
page
=
renderPage
()
const
page
=
await
renderPage
()
const
{
css
,
ids
}
=
renderStatic
(()
=>
page
.
html
||
page
.
errorHtml
)
const
{
css
,
ids
}
=
renderStatic
(()
=>
page
.
html
||
page
.
errorHtml
)
return
{
...
page
,
css
,
ids
}
return
{
...
page
,
css
,
ids
}
}
}
...
...
examples/with-goober/pages/_document.js
View file @
fcc4d8cd
...
@@ -2,9 +2,8 @@ import Document, { Head, Main, NextScript } from 'next/document'
...
@@ -2,9 +2,8 @@ import Document, { Head, Main, NextScript } from 'next/document'
import
{
extractCss
}
from
'goober'
import
{
extractCss
}
from
'goober'
export
default
class
MyDocument
extends
Document
{
export
default
class
MyDocument
extends
Document
{
static
getInitialProps
({
renderPage
})
{
static
async
getInitialProps
({
renderPage
})
{
const
page
=
renderPage
()
const
page
=
await
renderPage
()
// Extrach the css for each page render
// Extrach the css for each page render
const
css
=
extractCss
()
const
css
=
extractCss
()
return
{
...
page
,
css
}
return
{
...
page
,
css
}
...
...
examples/with-react-native-web/pages/_document.js
View file @
fcc4d8cd
...
@@ -15,7 +15,7 @@ export default class MyDocument extends Document {
...
@@ -15,7 +15,7 @@ export default class MyDocument extends Document {
static
async
getInitialProps
({
renderPage
})
{
static
async
getInitialProps
({
renderPage
})
{
AppRegistry
.
registerComponent
(
config
.
name
,
()
=>
Main
)
AppRegistry
.
registerComponent
(
config
.
name
,
()
=>
Main
)
const
{
getStyleElement
}
=
AppRegistry
.
getApplication
(
config
.
name
)
const
{
getStyleElement
}
=
AppRegistry
.
getApplication
(
config
.
name
)
const
page
=
renderPage
()
const
page
=
await
renderPage
()
const
styles
=
[
const
styles
=
[
<
style
dangerouslySetInnerHTML
=
{{
__html
:
normalizeNextElements
}}
/>
,
<
style
dangerouslySetInnerHTML
=
{{
__html
:
normalizeNextElements
}}
/>
,
getStyleElement
(),
getStyleElement
(),
...
...
examples/with-tailwindcss-emotion/pages/_document.js
View file @
fcc4d8cd
...
@@ -10,7 +10,7 @@ import { extractCritical } from '@emotion/server'
...
@@ -10,7 +10,7 @@ import { extractCritical } from '@emotion/server'
export
default
class
MyDocument
extends
Document
{
export
default
class
MyDocument
extends
Document
{
static
async
getInitialProps
(
ctx
)
{
static
async
getInitialProps
(
ctx
)
{
const
initialProps
=
await
Document
.
getInitialProps
(
ctx
)
const
initialProps
=
await
Document
.
getInitialProps
(
ctx
)
const
page
=
ctx
.
renderPage
()
const
page
=
await
ctx
.
renderPage
()
const
styles
=
extractCritical
(
page
.
html
)
const
styles
=
extractCritical
(
page
.
html
)
return
{
...
initialProps
,
...
page
,
...
styles
}
return
{
...
initialProps
,
...
page
,
...
styles
}
}
}
...
...
examples/with-typestyle/pages/_document.js
View file @
fcc4d8cd
...
@@ -2,8 +2,8 @@ import Document, { Head, Main, NextScript } from 'next/document'
...
@@ -2,8 +2,8 @@ import Document, { Head, Main, NextScript } from 'next/document'
import
{
getStyles
}
from
'typestyle'
import
{
getStyles
}
from
'typestyle'
export
default
class
MyDocument
extends
Document
{
export
default
class
MyDocument
extends
Document
{
static
getInitialProps
({
renderPage
})
{
static
async
getInitialProps
({
renderPage
})
{
const
page
=
renderPage
()
const
page
=
await
renderPage
()
const
styleTags
=
getStyles
()
const
styleTags
=
getStyles
()
return
{
...
page
,
styleTags
}
return
{
...
page
,
styleTags
}
}
}
...
...
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