Skip to content

Commit b184754

Browse files
authored
Fix type of error argument for onError callback to subscribeToMore (#12739)
1 parent 3bdf391 commit b184754

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

.api-reports/api-report-core.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ export interface SubscribeToMoreOptions<TData = unknown, TSubscriptionVariables
903903
// (undocumented)
904904
document: DocumentNode_2 | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;
905905
// (undocumented)
906-
onError?: (error: Error) => void;
906+
onError?: (error: ErrorLike) => void;
907907
// (undocumented)
908908
updateQuery?: SubscribeToMoreUpdateQueryFn<TData, TVariables, TSubscriptionData>;
909909
// (undocumented)

.api-reports/api-report-react.api.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ interface SubscribeToMoreOptions<TData = unknown, TSubscriptionVariables extends
903903
// (undocumented)
904904
document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;
905905
// (undocumented)
906-
onError?: (error: Error) => void;
906+
onError?: (error: ErrorLike) => void;
907907
// Warning: (ae-forgotten-export) The symbol "SubscribeToMoreUpdateQueryFn" needs to be exported by the entry point index.d.ts
908908
//
909909
// (undocumented)
@@ -1628,12 +1628,12 @@ type WatchQueryOptions_2<TVariables extends OperationVariables_2 = OperationVari
16281628
// src/core/types.ts:238:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts
16291629
// src/core/types.ts:255:7 - (ae-forgotten-export) The symbol "Streaming" needs to be exported by the entry point index.d.ts
16301630
// src/core/types.ts:308:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
1631-
// src/core/watchQueryOptions.ts:177:3 - (ae-forgotten-export) The symbol "UpdateQueryOptions" needs to be exported by the entry point index.d.ts
1632-
// src/core/watchQueryOptions.ts:260:3 - (ae-forgotten-export) The symbol "MutationQueryReducersMap" needs to be exported by the entry point index.d.ts
1633-
// src/core/watchQueryOptions.ts:263:3 - (ae-forgotten-export) The symbol "NormalizedExecutionResult" needs to be exported by the entry point index.d.ts
1634-
// src/core/watchQueryOptions.ts:273:3 - (ae-forgotten-export) The symbol "MutationUpdaterFunction" needs to be exported by the entry point index.d.ts
1635-
// src/core/watchQueryOptions.ts:276:3 - (ae-forgotten-export) The symbol "OnQueryUpdated" needs to be exported by the entry point index.d.ts
1636-
// src/core/watchQueryOptions.ts:285:3 - (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts
1631+
// src/core/watchQueryOptions.ts:178:3 - (ae-forgotten-export) The symbol "UpdateQueryOptions" needs to be exported by the entry point index.d.ts
1632+
// src/core/watchQueryOptions.ts:261:3 - (ae-forgotten-export) The symbol "MutationQueryReducersMap" needs to be exported by the entry point index.d.ts
1633+
// src/core/watchQueryOptions.ts:264:3 - (ae-forgotten-export) The symbol "NormalizedExecutionResult" needs to be exported by the entry point index.d.ts
1634+
// src/core/watchQueryOptions.ts:274:3 - (ae-forgotten-export) The symbol "MutationUpdaterFunction" needs to be exported by the entry point index.d.ts
1635+
// src/core/watchQueryOptions.ts:277:3 - (ae-forgotten-export) The symbol "OnQueryUpdated" needs to be exported by the entry point index.d.ts
1636+
// src/core/watchQueryOptions.ts:286:3 - (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts
16371637
// src/react/hooks/useLoadableQuery.ts:70:7 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts
16381638
// src/react/hooks/useSuspenseFragment.ts:75:5 - (ae-forgotten-export) The symbol "From" needs to be exported by the entry point index.d.ts
16391639

.api-reports/api-report.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,7 +2465,7 @@ export interface SubscribeToMoreOptions<TData = unknown, TSubscriptionVariables
24652465
// (undocumented)
24662466
document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;
24672467
// (undocumented)
2468-
onError?: (error: Error) => void;
2468+
onError?: (error: ErrorLike) => void;
24692469
// (undocumented)
24702470
updateQuery?: SubscribeToMoreUpdateQueryFn<TData, TVariables, TSubscriptionData>;
24712471
// (undocumented)
@@ -2694,7 +2694,7 @@ interface WriteContext extends ReadMergeModifyContext {
26942694
// src/core/ObservableQuery.ts:145:5 - (ae-forgotten-export) The symbol "NextFetchPolicyContext" needs to be exported by the entry point index.d.ts
26952695
// src/core/ObservableQuery.ts:305:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
26962696
// src/core/QueryManager.ts:187:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
2697-
// src/core/watchQueryOptions.ts:252:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
2697+
// src/core/watchQueryOptions.ts:253:3 - (ae-forgotten-export) The symbol "IgnoreModifier" needs to be exported by the entry point index.d.ts
26982698
// src/local-state/LocalState.ts:140:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
26992699
// src/local-state/LocalState.ts:174:7 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
27002700
// src/local-state/LocalState.ts:194:7 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts

.changeset/old-mangos-grin.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+
Fix type of `error` argument on the `onError` option for `subscribeToMore` to `ErrorLike`.

.size-limits.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 43689,
3-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 38663,
4-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33356,
5-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27606
2+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 43643,
3+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 38635,
4+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33333,
5+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27618
66
}

src/core/watchQueryOptions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type {
1313
import type { ObservableQuery } from "./ObservableQuery.js";
1414
import type {
1515
DefaultContext,
16+
ErrorLike,
1617
InternalRefetchQueriesInclude,
1718
MutationQueryReducersMap,
1819
MutationUpdaterFunction,
@@ -202,7 +203,7 @@ export interface SubscribeToMoreOptions<
202203
TVariables,
203204
TSubscriptionData
204205
>;
205-
onError?: (error: Error) => void;
206+
onError?: (error: ErrorLike) => void;
206207
context?: DefaultContext;
207208
}
208209

0 commit comments

Comments
 (0)