From 01cc89845040828c6e1f2bc053ff9c853d1635c5 Mon Sep 17 00:00:00 2001 From: Adam Soffer Date: Tue, 7 Feb 2017 06:02:28 -0500 Subject: [PATCH] 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 --- examples/with-apollo/lib/initClient.js | 2 +- examples/with-apollo/lib/withData.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/with-apollo/lib/initClient.js b/examples/with-apollo/lib/initClient.js index 4f195b24..6fc52174 100644 --- a/examples/with-apollo/lib/initClient.js +++ b/examples/with-apollo/lib/initClient.js @@ -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 } }) }) diff --git a/examples/with-apollo/lib/withData.js b/examples/with-apollo/lib/withData.js index 240aae39..134a2339 100644 --- a/examples/with-apollo/lib/withData.js +++ b/examples/with-apollo/lib/withData.js @@ -29,8 +29,8 @@ export default (Component) => ( return { initialState: { ...state, - apollo: { - data: state.apollo.data + [client.reduxRootKey]: { + data: client.getInitialState().data } }, headers,