From 0a1648bf47490b312169c531aeb51ef4725e8d2e Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Tue, 30 Jan 2018 12:39:31 -0500 Subject: Saying goodbye to graphcool --- lib/withData.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/withData.js') diff --git a/lib/withData.js b/lib/withData.js index ab9fe78..0c68f49 100644 --- a/lib/withData.js +++ b/lib/withData.js @@ -12,13 +12,12 @@ function getComponentDisplayName(Component) { export default ComposedComponent => class WithData extends React.Component { static displayName = `WithData(${getComponentDisplayName(ComposedComponent)})`; - static propTypes = { serverState: PropTypes.object.isRequired, }; static async getInitialProps(ctx) { - let serverState = {}; + let serverState = { apollo: {} }; // Evaluate the composed component's getInitialProps() let composedInitialProps = {}; @@ -49,7 +48,11 @@ export default ComposedComponent => Head.rewind(); // Extract query data from the Apollo store - serverState = apollo.cache.extract(); + serverState = { + apollo: { + data: apollo.cache.extract(), + }, + }; } return { @@ -60,7 +63,7 @@ export default ComposedComponent => constructor(props) { super(props); - this.apollo = initApollo(this.props.serverState); + this.apollo = initApollo(this.props.serverState.apollo.data); } render() { -- cgit v1.3