Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Simplify apollo client access #189

Merged
merged 1 commit into from
Sep 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ export function withApollo(WrappedComponent) {

constructor(props, context) {
super(props, context);
this.client = props.client || context.client;
this.client = context.client;

invariant(!!this.client,
`Could not find "client" in either the context or ` +
`props of "${withDisplayName}". ` +
`Either wrap the root component in an <ApolloProvider>, ` +
`or explicitly pass "client" as a prop to "${withDisplayName}".`
);
`Could not find "client" in the context of ` +
`"${withDisplayName}". ` +
`Wrap the root component in an <ApolloProvider>`
);

}


Expand Down Expand Up @@ -258,16 +258,16 @@ export default function graphql(
constructor(props, context) {
super(props, context);
this.version = version;
this.client = props.client || context.client;
this.store = this.client.store;
this.client = context.client;

invariant(!!this.client,
`Could not find "client" in either the context or ` +
`props of "${graphQLDisplayName}". ` +
`Either wrap the root component in an <ApolloProvider>, ` +
`or explicitly pass "client" as a prop to "${graphQLDisplayName}".`
`Could not find "client" in the context of ` +
`"${graphQLDisplayName}". ` +
`Wrap the root component in an <ApolloProvider>`
);

this.store = this.client.store;

this.type = operation.type;
this.queryObservable = {};
this.querySubscription = {};
Expand Down