diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1c7a799ffd..8901de3d29d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -238,6 +238,9 @@
- Expand `ApolloError` typings to include `ServerError` and `ServerParseError`.
[@dmarkow](https://github.com/dmarkow) in [#6319](https://github.com/apollographql/apollo-client/pull/6319)
+- Fast responses received over the link chain will no longer conflict with `skip` settings.
+ [@hwillson](https://github.com/hwillson) in [#TODO](https://github.com/apollographql/apollo-client/pull/TODO)
+
## Apollo Client 2.6.8
### Apollo Client (2.6.8)
diff --git a/src/react/data/QueryData.ts b/src/react/data/QueryData.ts
index 86d132e2205..4d3ad689830 100644
--- a/src/react/data/QueryData.ts
+++ b/src/react/data/QueryData.ts
@@ -279,18 +279,6 @@ export class QueryData extends OperationData {
return;
}
- // If we skipped previously, `previousResult.data` is set to undefined.
- // When this subscription is run after skipping, Apollo Client sends
- // the last query result data alongside the `loading` true state. This
- // means the previous skipped `data` of undefined and the incoming
- // data won't match, which would normally mean we want to trigger a
- // render to show the new data. In this case however we're already
- // showing the loading state, and want to avoid triggering an
- // additional and unnecessary render showing the same loading state.
- if (this.previousOptions.skip) {
- return;
- }
-
onNewData();
},
error: error => {
diff --git a/src/react/hooks/__tests__/useQuery.test.tsx b/src/react/hooks/__tests__/useQuery.test.tsx
index a769f1d186e..00934da704a 100644
--- a/src/react/hooks/__tests__/useQuery.test.tsx
+++ b/src/react/hooks/__tests__/useQuery.test.tsx
@@ -2049,4 +2049,41 @@ describe('useQuery Hook', () => {
}).then(resolve, reject);
});
});
+
+ describe('Skipping', () => {
+ itAsync('should skip running a query when `skip` is `true`', (resolve, reject) => {
+ let renderCount = 0;
+ const Component = () => {
+ const [skip, setSkip] = useState(true);
+ const { loading, data } = useQuery(CAR_QUERY, { skip });
+ switch (renderCount) {
+ case 0:
+ expect(loading).toBeFalsy();
+ expect(data).toBeUndefined();
+ setTimeout(() => setSkip(false));
+ break;
+ case 1:
+ expect(loading).toBeTruthy();
+ expect(data).toBeUndefined();
+ break;
+ case 2:
+ expect(loading).toBeFalsy();
+ expect(data).toEqual(CAR_RESULT_DATA);
+ break;
+ default:
+ }
+
+ renderCount += 1;
+ return null;
+ };
+
+ render(
+
+
+
+ );
+
+ return wait(() => expect(renderCount).toBe(3)).then(resolve, reject);
+ });
+ });
});