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

Commit

Permalink
remove the full client from the graphql HOC
Browse files Browse the repository at this point in the history
  • Loading branch information
James Baxley committed Aug 12, 2016
1 parent 3220b1d commit 1070a10
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
10 changes: 0 additions & 10 deletions src/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,6 @@ export default function graphql(
const clientProps = this.calculateResultProps(data);
const mergedPropsAndData = assign({}, props, clientProps);

// dynmically get all of the methods from ApolloClient
for (let key in this.client) {
if (!this.client.hasOwnProperty(key)) continue;

// don't overwrite any spyed methods like refetch
if (typeof this.client[key] === 'function' && !mergedPropsAndData[key]) {
mergedPropsAndData[key] = this.client[key];
}
}

if (!haveOwnPropsChanged && !hasOperationDataChanged && renderedElement) {
return renderedElement;
}
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function renderToStringWithData(component) {
for (let field of fieldsToNotShip) delete initialState[key].queries[queryId][field];
}
initialState = encodeURI(JSON.stringify(initialState));
const payload = `<script>window.__APOLLO_STATE__ = ${initialState};</script>`;
const payload = `<script>window.__APOLLO_STATE__ = "${initialState}";</script>`;
markup += payload;
return markup;
});
Expand Down

0 comments on commit 1070a10

Please sign in to comment.