diff --git a/Changelog.md b/Changelog.md
index 85778f2789..48b6dc18b3 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,6 +4,10 @@ Expect active development and potentially significant breaking changes in the `0
### vNext
+### v0.5.10
+
+- Bug: Fix issue with changing outer props *and not changing variables*, ultimately caused by https://github.com/apollostack/apollo-client/pull/694
+
### v0.5.9
- Bug: Fix and test some subtle bugs around skipping and subscriptions. [#260](https://github.com/apollostack/react-apollo/pull/260)
diff --git a/package.json b/package.json
index 9e54c33ac9..6990c9e9a0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-apollo",
- "version": "0.5.9",
+ "version": "0.5.10",
"description": "React data container for Apollo Client",
"main": "index.js",
"typings": "index.d.ts",
@@ -50,7 +50,7 @@
"peerDependencies": {
"react": "0.14.x || 15.* || ^15.0.0",
"redux": "^2.0.0 || ^3.0.0",
- "apollo-client": "^0.4.20"
+ "apollo-client": "^0.4.21"
},
"devDependencies": {
"@types/chai": "^3.4.33",
@@ -69,7 +69,7 @@
"@types/redux-form": "^4.0.29",
"@types/redux-immutable": "^3.0.30",
"@types/sinon": "^1.16.29",
- "apollo-client": "^0.4.20",
+ "apollo-client": "^0.4.21",
"babel-jest": "^14.1.0",
"babel-preset-react-native": "^1.9.0",
"browserify": "^13.0.0",
diff --git a/src/graphql.tsx b/src/graphql.tsx
index 2dc660d31b..11a6583944 100644
--- a/src/graphql.tsx
+++ b/src/graphql.tsx
@@ -375,7 +375,9 @@ export default function graphql(
// We've subscribed already, just update with our new options and
// take the latest result
if (this.querySubscription) {
- this.queryObservable.setOptions(opts);
+ // Since we don't care about the result, use a hacky version to
+ // work around https://github.com/apollostack/apollo-client/pull/694
+ this.queryObservable._setOptionsNoResult(opts);
// Ensure we are up-to-date with the latest state of the world
assign(this.data,
diff --git a/test/react-web/client/graphql/queries-1.test.tsx b/test/react-web/client/graphql/queries-1.test.tsx
index fcaba89392..ff79c2d7dc 100644
--- a/test/react-web/client/graphql/queries-1.test.tsx
+++ b/test/react-web/client/graphql/queries-1.test.tsx
@@ -898,6 +898,58 @@ describe('queries', () => {
renderer.create();
});
+ it('stays subscribed to updates after irrelevant prop changes', (done) => {
+ const query = gql`query people($first: Int) { allPeople(first: $first) { people { name } } }`;
+ const variables = { first: 1 };
+ const data1 = { allPeople: { people: [ { name: 'Luke Skywalker' } ] } };
+ const data2 = { allPeople: { people: [ { name: 'Leia Skywalker' } ] } };
+ const networkInterface = mockNetworkInterface(
+ { request: { query, variables }, result: { data: data1 } },
+ { request: { query, variables }, result: { data: data2 } },
+ );
+ const client = new ApolloClient({ networkInterface });
+
+ let count = 0;
+ @graphql(query, { options() { return { variables }; } })
+ class Container extends React.Component {8
+ componentWillReceiveProps(props) {
+ count += 1;
+
+ if (count == 1) {
+ expect(props.foo).toEqual(42);
+ expect(props.data.loading).toEqual(false);
+ expect(props.data.allPeople).toEqual(data1.allPeople);
+ props.changeState();
+ } else if (count == 2) {
+ expect(props.foo).toEqual(43);
+ expect(props.data.loading).toEqual(false);
+ expect(props.data.allPeople).toEqual(data1.allPeople);
+ props.data.refetch();
+ } else if (count == 3) {
+ expect(props.foo).toEqual(43);
+ expect(props.data.loading).toEqual(false);
+ expect(props.data.allPeople).toEqual(data2.allPeople);
+ done();
+ }
+ }
+ render() {
+ return null;
+ }
+ };
+
+ class Parent extends React.Component {
+ constructor() {
+ super();
+ this.state = { foo: 42 };
+ }
+ render() {
+ return this.setState({ foo: 43 })}/>;
+ }
+ };
+
+ renderer.create();
+ });
+
it('exposes refetch as part of the props api', (done) => {
const query = gql`query people($first: Int) { allPeople(first: $first) { people { name } } }`;
const variables = { first: 1 };