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
3be175b4
Commit
3be175b4
authored
Jun 28, 2017
by
Thomas Preusse
Committed by
Tim Neutkens
Jun 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apollo Example: Fix duplicate head tags (#2362)
parent
19b6cca4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
withData.js
examples/with-apollo-and-redux/lib/withData.js
+4
-0
withData.js
examples/with-apollo/lib/withData.js
+4
-0
No files found.
examples/with-apollo-and-redux/lib/withData.js
View file @
3be175b4
import
React
from
'react'
import
PropTypes
from
'prop-types'
import
{
ApolloProvider
,
getDataFromTree
}
from
'react-apollo'
import
Head
from
'next/head'
import
initApollo
from
'./initApollo'
import
initRedux
from
'./initRedux'
...
...
@@ -37,6 +38,9 @@ export default ComposedComponent => {
<
/ApolloProvider
>
)
await
getDataFromTree
(
app
)
// getDataFromTree does not call componentWillUnmount
// head side effect therefore need to be cleared manually
Head
.
rewind
()
// Extract query data from the store
const
state
=
redux
.
getState
()
...
...
examples/with-apollo/lib/withData.js
View file @
3be175b4
import
React
from
'react'
import
PropTypes
from
'prop-types'
import
{
ApolloProvider
,
getDataFromTree
}
from
'react-apollo'
import
Head
from
'next/head'
import
initApollo
from
'./initApollo'
export
default
ComposedComponent
=>
{
...
...
@@ -33,6 +34,9 @@ export default ComposedComponent => {
<
/ApolloProvider
>
)
await
getDataFromTree
(
app
)
// getDataFromTree does not call componentWillUnmount
// head side effect therefore need to be cleared manually
Head
.
rewind
()
// Extract query data from the Apollo's store
const
state
=
apollo
.
getInitialState
()
...
...
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