Skip to content

Commit 01cc898

Browse files
adamsoffertimneutkens
authored andcommitted
Update Apollo example (vercel#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
1 parent 8dfbbd3 commit 01cc898

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

examples/with-apollo/lib/initClient.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ let apolloClient = null
55
function createClient (headers) {
66
return new ApolloClient({
77
ssrMode: !process.browser,
8-
headers,
98
dataIdFromObject: result => result.id || null,
109
networkInterface: createNetworkInterface({
1110
uri: 'https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn',
1211
opts: {
1312
credentials: 'same-origin'
13+
// Pass headers here if your graphql server requires them
1414
}
1515
})
1616
})

examples/with-apollo/lib/withData.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export default (Component) => (
2929
return {
3030
initialState: {
3131
...state,
32-
apollo: {
33-
data: state.apollo.data
32+
[client.reduxRootKey]: {
33+
data: client.getInitialState().data
3434
}
3535
},
3636
headers,

0 commit comments

Comments
 (0)