Skip to content

Commit 3be175b

Browse files
tpreussetimneutkens
authored andcommittedJun 28, 2017
Apollo Example: Fix duplicate head tags (#2362)
1 parent 19b6cca commit 3be175b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
 

‎examples/with-apollo-and-redux/lib/withData.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
33
import { ApolloProvider, getDataFromTree } from 'react-apollo'
4+
import Head from 'next/head'
45
import initApollo from './initApollo'
56
import initRedux from './initRedux'
67

@@ -37,6 +38,9 @@ export default ComposedComponent => {
3738
</ApolloProvider>
3839
)
3940
await getDataFromTree(app)
41+
// getDataFromTree does not call componentWillUnmount
42+
// head side effect therefore need to be cleared manually
43+
Head.rewind()
4044

4145
// Extract query data from the store
4246
const state = redux.getState()

‎examples/with-apollo/lib/withData.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
33
import { ApolloProvider, getDataFromTree } from 'react-apollo'
4+
import Head from 'next/head'
45
import initApollo from './initApollo'
56

67
export default ComposedComponent => {
@@ -33,6 +34,9 @@ export default ComposedComponent => {
3334
</ApolloProvider>
3435
)
3536
await getDataFromTree(app)
37+
// getDataFromTree does not call componentWillUnmount
38+
// head side effect therefore need to be cleared manually
39+
Head.rewind()
3640

3741
// Extract query data from the Apollo's store
3842
const state = apollo.getInitialState()

0 commit comments

Comments
 (0)
Please sign in to comment.