diff --git a/examples/with-apollo/components/PostList.js b/examples/with-apollo/components/PostList.js index 161dc4c94496a..7804cdb0881bb 100644 --- a/examples/with-apollo/components/PostList.js +++ b/examples/with-apollo/components/PostList.js @@ -4,65 +4,64 @@ import PostUpvoter from './PostUpvoter' const POSTS_PER_PAGE = 10 function PostList ({ data: { allPosts, loading, _allPostsMeta }, loadMorePosts }) { - if (loading) { - return
Loading
+ if (allPosts && allPosts.length) { + const areMorePosts = allPosts.length < _allPostsMeta.count + return ( +
+ + {areMorePosts ? : ''} + +
+ ) } - - const areMorePosts = allPosts.length < _allPostsMeta.count - - return ( -
- - {areMorePosts ? : ''} - -
- ) + return
Loading
} const allPosts = gql` diff --git a/examples/with-apollo/lib/withData.js b/examples/with-apollo/lib/withData.js index cdb0ddd3e6997..d9f44a4b87619 100644 --- a/examples/with-apollo/lib/withData.js +++ b/examples/with-apollo/lib/withData.js @@ -26,10 +26,11 @@ export default (Component) => ( } const state = store.getState() + return { initialState: { ...state, - [client.reduxRootKey]: { + apollo: { data: client.getInitialState().data } },