Skip to content

Commit 5c5ca9b

Browse files
authored
Ensure onError is called when errorPolicy is set to "all" and partial data is returned (apollographql#10383)
* Minor tweak to test name to make it more clear its intent * Add 2 new tests to ensure onError is called with network and graphql errors * Add wait and tick helpers for testing * Fix typo * Add tests to validate when onError is called when errorPolicy is ignore * Slight verbage change * Add test to validate partial data is removed from result * Add check of data * Add test to validate graphql errors are discarded with partial data * Add missing semicolons * Add missing expectation * Add failing tests for onError not being called with errorPolicy = "all" * Add failing test for calling onCompleted with partial data * Remove unneeded mock in test * Ensure `onError` is called when GraphQL errors are returned * Fix onCompleted mock not passed to hook * Update bundlesize * Update snapshot tests * Add changeset
1 parent 73b0bb5 commit 5c5ca9b

7 files changed

Lines changed: 431 additions & 4 deletions

File tree

.changeset/curly-cameras-carry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@apollo/client': patch
3+
---
4+
5+
Ensure the `onError` callback is called when the `errorPolicy` is set to "all" and partial data is returned.

config/bundlesize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { join } from "path";
33
import { gzipSync } from "zlib";
44
import bytes from "bytes";
55

6-
const gzipBundleByteLengthLimit = bytes("32KB");
6+
const gzipBundleByteLengthLimit = bytes("32.03KB");
77
const minFile = join("dist", "apollo-client.min.cjs");
88
const minPath = join(__dirname, "..", minFile);
99
const gzipByteLen = gzipSync(readFileSync(minPath)).byteLength;

src/__tests__/__snapshots__/exports.ts.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ Array [
320320
"mockObservableLink",
321321
"mockSingleLink",
322322
"subscribeAndCount",
323+
"tick",
324+
"wait",
323325
"withErrorSpy",
324326
"withLogSpy",
325327
"withWarningSpy",
@@ -335,6 +337,8 @@ Array [
335337
"mockObservableLink",
336338
"mockSingleLink",
337339
"subscribeAndCount",
340+
"tick",
341+
"wait",
338342
"withErrorSpy",
339343
"withLogSpy",
340344
"withWarningSpy",

0 commit comments

Comments
 (0)