mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Update Apollo example (#1021)
* Add minimal apollo example * Update apollo example README * Update apollo example demo link in README * Fix button styles * Fix show more button * Alias demo url * Include the data field on the Apollo store when hydrating * Revert * Include the data field on the Apollo store when hydrating per tpreusse's suggestion. * Add example to faq section in README * Sort by newest; Add active state to buttons * Make optimization suggestions * Use process.browser; inline props * Pass wrapped component's initial props into component heirarchy if they exist * Remove unnecessary sorting of array * Update Apollo example * Remove trailing comma * Update reduxRootKey * Remove unnecessary babelrc
This commit is contained in:
parent
8dfbbd3674
commit
01cc898450
|
@ -5,12 +5,12 @@ let apolloClient = null
|
|||
function createClient (headers) {
|
||||
return new ApolloClient({
|
||||
ssrMode: !process.browser,
|
||||
headers,
|
||||
dataIdFromObject: result => result.id || null,
|
||||
networkInterface: createNetworkInterface({
|
||||
uri: 'https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn',
|
||||
opts: {
|
||||
credentials: 'same-origin'
|
||||
// Pass headers here if your graphql server requires them
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -29,8 +29,8 @@ export default (Component) => (
|
|||
return {
|
||||
initialState: {
|
||||
...state,
|
||||
apollo: {
|
||||
data: state.apollo.data
|
||||
[client.reduxRootKey]: {
|
||||
data: client.getInitialState().data
|
||||
}
|
||||
},
|
||||
headers,
|
||||
|
|
Loading…
Reference in a new issue