From b59788088c1f65eb51cb2571630a89d363279a2f Mon Sep 17 00:00:00 2001 From: James Baxley Date: Wed, 6 Jul 2016 15:56:24 -0400 Subject: [PATCH] pass all arguments through to child (#94) --- Changelog.md | 4 ++++ package.json | 2 +- src/connect.tsx | 8 ++------ test/client/connect/props.tsx | 1 - test/client/connect/queries.tsx | 11 +++++------ test/client/connect/redux.tsx | 6 +----- 6 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Changelog.md b/Changelog.md index a747e88040..e51fd69421 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,10 @@ Expect active development and potentially significant breaking changes in the `0.x` track. We'll try to be diligent about releasing a `1.0` version in a timely fashion (ideally within 1 or 2 months), so that we can take advantage of SemVer to signify breaking changes from that point on. +### v0.3.14 + +Feature: pass through all methods on apollo client + ### v0.3.13 Bug: fixed issue causing errors to be passed to apollo-client [#89](https://github.com/apollostack/react-apollo/pull/89) diff --git a/package.json b/package.json index 4231845fd1..98d57eba89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-apollo", - "version": "0.3.13", + "version": "0.3.14", "description": "React data container for Apollo Client", "main": "index.js", "scripts": { diff --git a/src/connect.tsx b/src/connect.tsx index 195f3a243b..e49c6363fa 100644 --- a/src/connect.tsx +++ b/src/connect.tsx @@ -524,17 +524,13 @@ export default function connect(opts?: ConnectOptions) { this.hasQueryDataChanged = false; this.hasMutationDataChanged = false; - let clientProps = { - mutate: this.client.mutate, - query: this.client.query, - watchQuery: this.client.watchQuery, - } as any; + let clientProps = {} as any; if (Object.keys(mutations).length) { clientProps.mutations = mutations; } - const mergedPropsAndData = assign({}, props, data, clientProps); + const mergedPropsAndData = assign({}, props, clientProps, this.client, data); if ( !haveOwnPropsChanged && !hasOwnStateChanged && diff --git a/test/client/connect/props.tsx b/test/client/connect/props.tsx index b850138f1c..cabc2d405d 100644 --- a/test/client/connect/props.tsx +++ b/test/client/connect/props.tsx @@ -68,7 +68,6 @@ describe('props', () => { const props = wrapper.find('span').props() as any; - expect(props.query).to.exist; expect(props.query({ query })).to.be.instanceof(Promise); diff --git a/test/client/connect/queries.tsx b/test/client/connect/queries.tsx index a502b7c6b1..13473e7cbb 100644 --- a/test/client/connect/queries.tsx +++ b/test/client/connect/queries.tsx @@ -535,11 +535,11 @@ describe('queries', () => { }; const variables1 = { - person: 1 + person: 1, } const variables2 = { - person: 2 + person: 2, } const networkInterface = mockNetworkInterface( @@ -557,7 +557,6 @@ describe('queries', () => { networkInterface, }); - let firstRun = true; function mapQueriesToProps({ state }) { return { people: { @@ -574,7 +573,7 @@ describe('queries', () => { case 'INCREMENT': return state + 1 default: - return state + return state; } } @@ -1926,9 +1925,9 @@ describe('queries', () => { ); setTimeout(() => { - expect(localcount).to.equal(2); + expect(localcount).to.equal(1); done(); - }, 50); + }, 100); }); it('should not swallow errors', (done) => { const query = gql` diff --git a/test/client/connect/redux.tsx b/test/client/connect/redux.tsx index 583d9baa3b..9cdfad33fc 100644 --- a/test/client/connect/redux.tsx +++ b/test/client/connect/redux.tsx @@ -57,11 +57,7 @@ describe('redux integration', () => { ); - const reduxProps = assign({}, wrapper.find('span').props(), { - query: undefined, - mutate: undefined, - watchQuery: undefined, - }); + const reduxProps = assign({}, wrapper.find('span').props()); const apolloProps = apolloWrapper.find('span').props(); expect(reduxProps).to.deep.equal(apolloProps);