Skip to content

Commit 16ee78f

Browse files
committed
Merge branch 'main' into release-4.0
2 parents 388ba97 + f3b5d29 commit 16ee78f

File tree

22 files changed

+508
-105
lines changed

22 files changed

+508
-105
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ export class DeepMerger<TContextArgs extends any[]> {
718718
//
719719
// @public (undocumented)
720720
export type DeepOmit<T, K> = T extends DeepOmitPrimitive ? T : {
721-
[P in Exclude<keyof T, K>]: T[P] extends infer TP ? TP extends DeepOmitPrimitive ? TP : TP extends any[] ? DeepOmitArray<TP, K> : DeepOmit<TP, K> : never;
721+
[P in keyof T as P extends K ? never : P]: T[P] extends infer TP ? TP extends DeepOmitPrimitive ? TP : TP extends any[] ? DeepOmitArray<TP, K> : DeepOmit<TP, K> : never;
722722
};
723723

724724
// @public (undocumented)

.changeset/fresh-spies-burn.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/shiny-sheep-behave.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# @apollo/client
22

3+
## 3.13.4
4+
5+
### Patch Changes
6+
7+
- [#12420](https://github.com/apollographql/apollo-client/pull/12420) [`fee9368`](https://github.com/apollographql/apollo-client/commit/fee9368750e242ea03dea8d1557683506d411d8d) Thanks [@jorenbroekema](https://github.com/jorenbroekema)! - Use import star from `rehackt` to prevent issues with importing named exports from external CJS modules.
8+
9+
## 3.13.3
10+
11+
### Patch Changes
12+
13+
- [#12362](https://github.com/apollographql/apollo-client/pull/12362) [`f6d387c`](https://github.com/apollographql/apollo-client/commit/f6d387c166cc76f08135966fb6d74fd8fe808c21) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixes an issue where calling `observableQuery.getCurrentResult()` when the `errorPolicy` was set to `all` would return the `networkStatus` as `NetworkStatus.ready` when there were errors returned in the result. This has been corrected to report `NetworkStatus.error`.
14+
15+
This bug also affected the `useQuery` and `useLazyQuery` hooks and may affect you if you check for `networkStatus` in your component.
16+
17+
## 3.13.2
18+
19+
### Patch Changes
20+
21+
- [#12409](https://github.com/apollographql/apollo-client/pull/12409) [`6aa2f3e`](https://github.com/apollographql/apollo-client/commit/6aa2f3e81ee0ae59da7ae0b12000bb5a55ec5c6d) Thanks [@phryneas](https://github.com/phryneas)! - To mitigate problems when Apollo Client ends up more than once in the bundle, some unique symbols were converted into `Symbol.for` calls.
22+
23+
- [#12392](https://github.com/apollographql/apollo-client/pull/12392) [`644bb26`](https://github.com/apollographql/apollo-client/commit/644bb2662168a9bac0519be6979f0db38b0febc4) Thanks [@Joja81](https://github.com/Joja81)! - Fixes an issue where the DeepOmit type would turn optional properties into required properties. This should only affect you if you were using the omitDeep or stripTypename utilities exported by Apollo Client.
24+
25+
- [#12404](https://github.com/apollographql/apollo-client/pull/12404) [`4332b88`](https://github.com/apollographql/apollo-client/commit/4332b886f0409145af57f26d334f86e5a1b465c5) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Show `NaN` rather than converting to `null` in debug messages from `MockLink` for unmatched `variables` values.
26+
27+
## 3.13.1
28+
29+
### Patch Changes
30+
31+
- [#12369](https://github.com/apollographql/apollo-client/pull/12369) [`bdfc5b2`](https://github.com/apollographql/apollo-client/commit/bdfc5b2e386ed5f835716a542de0cf17da37f7fc) Thanks [@phryneas](https://github.com/phryneas)! - `ObervableQuery.refetch`: don't refetch with `cache-and-network`, swich to `network-only` instead
32+
33+
- [#12375](https://github.com/apollographql/apollo-client/pull/12375) [`d3f8f13`](https://github.com/apollographql/apollo-client/commit/d3f8f130718ef50531ca0079192c2672a513814a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Export the `UseSuspenseFragmentOptions` type.
34+
335
## 3.13.0
436

537
### Minor Changes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
---
1313

1414
**Announcement:**
15-
Join 1000+ engineers at GraphQL Summit for talks, workshops, and office hours, Oct 8-10 in NYC. [Get your pass here ->](https://summit.graphql.com/?utm_campaign=github_federation_readme)
15+
Join 1000+ engineers at GraphQL Summit 2025 by Apollo for talks, workshops, and office hours. Oct 6-8, 2025 in San Francisco. [Get your pass here ->](https://www.apollographql.com/graphql-summit-2025?utm_campaign=2025-03-04_graphql-summit-github-announcement&utm_medium=github&utm_source=apollo-server)
1616

1717
---
1818

docs/source/data/subscriptions.mdx

Lines changed: 57 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -460,69 +460,75 @@ const COMMENTS_SUBSCRIPTION = gql`
460460

461461
</MultiCodeBlock>
462462

463-
Next, we modify our `CommentsPageWithData` function to add a `subscribeToNewComments` property to the `CommentsPage` component it returns. This property is a function that will be responsible for calling `subscribeToMore` after the component mounts.
463+
Next, we modify our `CommentsPageWithData` component to call `subscribeToMore` after the comments query loads.
464464

465465
<MultiCodeBlock>
466466

467467
```tsx {10-25}
468468
function CommentsPageWithData({ params }: CommentsPageWithDataProps) {
469-
const { subscribeToMore, ...result } = useQuery(
470-
COMMENTS_QUERY,
471-
{ variables: { postID: params.postID } }
472-
);
469+
const { subscribeToMore, ...result } = useQuery(COMMENTS_QUERY, {
470+
variables: { postID: params.postID },
471+
});
472+
473+
useEffect(() => {
474+
// This assumes you want to wait to start the subscription
475+
// after the query has loaded.
476+
if (result.data) {
477+
const unsubscribe = subscribeToMore({
478+
document: COMMENTS_SUBSCRIPTION,
479+
variables: { postID: params.postID },
480+
updateQuery: (prev, { subscriptionData }) => {
481+
if (!subscriptionData.data) return prev;
482+
const newFeedItem = subscriptionData.data.commentAdded;
483+
484+
return Object.assign({}, prev, {
485+
post: {
486+
comments: [newFeedItem, ...prev.post.comments],
487+
},
488+
});
489+
},
490+
});
491+
492+
return () => {
493+
unsubscribe();
494+
};
495+
}
496+
}, [result.data, params.postID, subscribeToMore]);
473497

474-
return (
475-
<CommentsPage
476-
{...result}
477-
subscribeToNewComments={() =>
478-
subscribeToMore({
479-
document: COMMENTS_SUBSCRIPTION,
480-
variables: { postID: params.postID },
481-
updateQuery: (prev, { subscriptionData }) => {
482-
if (!subscriptionData.data) return prev;
483-
const newFeedItem = subscriptionData.data.commentAdded;
484-
485-
return Object.assign({}, prev, {
486-
post: {
487-
comments: [newFeedItem, ...prev.post.comments]
488-
}
489-
});
490-
}
491-
})
492-
}
493-
/>
494-
);
498+
return <CommentsPage {...result} />;
495499
}
496500
```
497501

498502
```jsx {10-25}
499503
function CommentsPageWithData({ params }) {
500-
const { subscribeToMore, ...result } = useQuery(
501-
COMMENTS_QUERY,
502-
{ variables: { postID: params.postID } }
503-
);
504+
const { subscribeToMore, ...result } = useQuery(COMMENTS_QUERY, {
505+
variables: { postID: params.postID },
506+
});
507+
508+
useEffect(() => {
509+
if (result.data) {
510+
const unsubscribe = subscribeToMore({
511+
document: COMMENTS_SUBSCRIPTION,
512+
variables: { postID: params.postID },
513+
updateQuery: (prev, { subscriptionData }) => {
514+
if (!subscriptionData.data) return prev;
515+
const newFeedItem = subscriptionData.data.commentAdded;
516+
517+
return Object.assign({}, prev, {
518+
post: {
519+
comments: [newFeedItem, ...prev.post.comments],
520+
},
521+
});
522+
},
523+
});
524+
525+
return () => {
526+
unsubscribe();
527+
};
528+
}
529+
}, [result.data, params.postID]);
504530

505-
return (
506-
<CommentsPage
507-
{...result}
508-
subscribeToNewComments={() =>
509-
subscribeToMore({
510-
document: COMMENTS_SUBSCRIPTION,
511-
variables: { postID: params.postID },
512-
updateQuery: (prev, { subscriptionData }) => {
513-
if (!subscriptionData.data) return prev;
514-
const newFeedItem = subscriptionData.data.commentAdded;
515-
516-
return Object.assign({}, prev, {
517-
post: {
518-
comments: [newFeedItem, ...prev.post.comments]
519-
}
520-
});
521-
}
522-
})
523-
}
524-
/>
525-
);
531+
return <CommentsPage {...result} />;
526532
}
527533
```
528534

@@ -534,28 +540,6 @@ In the example above, we pass three options to `subscribeToMore`:
534540
* `variables` indicates the variables to include when executing the subscription.
535541
* `updateQuery` is a function that tells Apollo Client how to combine the query's currently cached result (`prev`) with the `subscriptionData` that's pushed by our GraphQL server. The return value of this function **completely replaces** the current cached result for the query.
536542

537-
Finally, in our definition of `CommentsPage`, we tell the component to `subscribeToNewComments` when it mounts:
538-
539-
<MultiCodeBlock>
540-
541-
```tsx
542-
export function CommentsPage({ subscribeToNewComments }: CommentsPageProps) {
543-
useEffect(() => subscribeToNewComments(), []);
544-
545-
return <>...</>
546-
}
547-
```
548-
549-
```jsx
550-
export function CommentsPage({ subscribeToNewComments }) {
551-
useEffect(() => subscribeToNewComments(), []);
552-
553-
return <>...</>
554-
}
555-
```
556-
557-
</MultiCodeBlock>
558-
559543
## `useSubscription` API reference
560544

561545
> **Note:** If you're using React Apollo's `Subscription` render prop component, the option/result details listed below are still valid (options are component props and results are passed into the render prop function). The only difference is that a `subscription` prop (which holds a GraphQL subscription document parsed into an AST by `gql`) is also required.

docs/source/integrations/webpack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default graphql(currentUserQuery)(Profile)
4747

4848
## Jest
4949

50-
[Jest](https://facebook.github.io/jest/) can't use the Webpack loaders. To make the same transformation work in Jest, use [jest-transform-graphql](https://github.com/remind101/jest-transform-graphql).
50+
[Jest](https://facebook.github.io/jest/) can't use the Webpack loaders. To make the same transformation work in Jest, use [jest-graphql-transformer](https://github.com/hamidyfine/jest-graphql-transformer).
5151

5252
## FuseBox
5353

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apollo/client",
3-
"version": "3.13.1",
3+
"version": "3.13.4",
44
"description": "A fully-featured caching GraphQL client.",
55
"private": true,
66
"keywords": [

src/core/ObservableQuery.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,17 @@ export class ObservableQuery<
304304
}
305305
}
306306

307+
// We need to check for both both `error` and `errors` field because there
308+
// are cases where sometimes `error` is set, but not `errors` and
309+
// vice-versa. This will be updated in the next major version when
310+
// `errors` is deprecated in favor of `error`.
311+
if (
312+
result.networkStatus === NetworkStatus.ready &&
313+
(result.error || result.errors)
314+
) {
315+
result.networkStatus = NetworkStatus.error;
316+
}
317+
307318
if (
308319
__DEV__ &&
309320
!diff.complete &&

0 commit comments

Comments
 (0)