mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Apollo Example: Fix duplicate head tags (#2362)
This commit is contained in:
parent
19b6cca44b
commit
3be175b466
|
@ -1,6 +1,7 @@
|
|||
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()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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()
|
||||
|
|
Loading…
Reference in a new issue