-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useSubscription: keep subscription Concast alive if new in-flight subscription subscribes at the same time last in-flight subscription unsubscribes #10718
Conversation
…erver unsubscribe immediately followed by new observer subscribe
… unsubscribe instead of delaying resolve/reject
…on is already closed at time of unsubscription
@Hsifnus: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
|
Name | Link |
---|---|
🔨 Latest commit | 6068147 |
🦋 Changeset detectedLatest commit: 10b51c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Could you please try if an approach like in #10629 would solve the problem as well? That would make it a much smaller change and only affect people that use the |
Figured out a way to immediately stop receiving subscription values in As such, I have shifted the PR to impact |
/release:pr |
1 similar comment
/release:pr |
A new release has been made for this PR. You can install it with |
@Hsifnus I believe you could circumvent the additional subscription doing something like this - what do you think? @@ -117,8 +117,10 @@ export function useSubscription<TData = any, TVariables extends OperationVariabl
return;
}
+ let subscriptionStopped = false;
const subscription = observable.subscribe({
next(fetchResult) {
+ if (subscriptionStopped) return;
const result = {
loading: false,
// TODO: fetchResult.data can be null but SubscriptionResult.data
@@ -142,6 +144,7 @@ export function useSubscription<TData = any, TVariables extends OperationVariabl
}
},
error(error) {
+ if (subscriptionStopped) return;
setResult({
loading: false,
data: void 0,
@@ -151,6 +154,7 @@ export function useSubscription<TData = any, TVariables extends OperationVariabl
ref.current.options?.onError?.(error);
},
complete() {
+ if (subscriptionStopped) return;
if (ref.current.options?.onComplete) {
ref.current.options.onComplete();
} else if (ref.current.options?.onSubscriptionComplete) {
@@ -163,14 +167,9 @@ export function useSubscription<TData = any, TVariables extends OperationVariabl
// immediately stop receiving subscription values, but do not unsubscribe
// until after a short delay in case another useSubscription hook is
// reusing the same underlying observable and is about to subscribe
- const ignoredSubscription = observable.subscribe({
- next() {},
- error() {},
- complete() {},
- });
- subscription.unsubscribe();
+ subscriptionStopped = true;
setTimeout(() => {
- ignoredSubscription.unsubscribe();
+ subscription.unsubscribe();
});
};
}, [observable]); |
…of useSubscription unsub
Looks like that would be the most straightforward way of circumventing the second subscription. Implemented something similar to that in c890e45 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me - let's get this in!
<h3>Snyk has created this PR to upgrade @apollo/client from 3.7.0 to 3.7.13.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> - The recommended version is **13 versions** ahead of your current version. - The recommended version was released **22 days ago**, on 2023-04-27. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>@apollo/client</b></summary> <ul> <li> <b>3.7.13</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.13">2023-04-27</a></br><h3>Patch Changes</h3> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10805" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10805/hovercard">#10805</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/a5503666c2cc8220ac1d877e3296556e54e58ff6"><code>a5503666c</code></a> Thanks <a href="https://snyk.io/redirect/github/phryneas">@ phryneas</a>! - Fix a potential memory leak in SSR scenarios when many <code>persistedQuery</code> instances were created over time.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10718" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10718/hovercard">#10718</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/577c68bdd26519f8341fd1188ea4b8aabe357856"><code>577c68bdd</code></a> Thanks <a href="https://snyk.io/redirect/github/Hsifnus">@ Hsifnus</a>! - Delay Concast subscription teardown slightly in <code>useSubscription</code> to prevent unexpected Concast teardown when one <code>useSubscription</code> hook tears down its in-flight Concast subscription immediately followed by another <code>useSubscription</code> hook reusing and subscribing to that same Concast</p> </li> </ul> </li> <li> <b>3.7.12</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.12">2023-04-12</a></br><h3>Patch Changes</h3> <ul> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10735" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10735/hovercard">#10735</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/895bcdcff146bc4575c8f3423c30fa9e885be16b"><code>895bcdcff</code></a> Thanks <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a>! - If a multipart chunk contains only <code>hasNext: false</code>, immediately complete the observable.</li> </ul> </li> <li> <b>3.7.11</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.11">2023-03-31</a></br><h3>Patch Changes</h3> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10586" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10586/hovercard">#10586</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/4175af59419dbb698c32c074f44229f3a5b3b83d"><code>4175af594</code></a> Thanks <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a>! - Improve WebSocket error handling for generic <code>Event</code> received on error. For more information see <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event</a>.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10411" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10411/hovercard">#10411</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/152baac343b8b68c7a2d4691d5dc60d9e43e62bb"><code>152baac34</code></a> Thanks <a href="https://snyk.io/redirect/github/lovasoa">@ lovasoa</a>! - Simplify error message generation and make 'undefined' an impossible message string.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10592" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10592/hovercard">#10592</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/cdb98ae082ae4c7da6cd6a0fd5ad8457810fceda"><code>cdb98ae08</code></a> Thanks <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a>! - Adds support for multipart subscriptions in <code>HttpLink</code>.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10698" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10698/hovercard">#10698</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/38508a251423057fd8a0df50230f50e0a5dde5fd"><code>38508a251</code></a> Thanks <a href="https://snyk.io/redirect/github/jerelmiller">@ jerelmiller</a>! - Changes the behavior of <code>useLazyQuery</code> introduced in <a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10427" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10427/hovercard">#10427</a> where unmounting a component before a query was resolved would reject the promise with an abort error. Instead, the promise will now resolve naturally with the result from the request.</p> <p>Other notable fixes:</p> <ul> <li>Kicking off multiple requests in parallel with the execution function will now ensure each returned promise is resolved with the data from its request. Previously, each promise was resolved with data from the last execution.</li> <li>Re-rendering <code>useLazyQuery</code> with a different query document will now ensure the execution function uses the updated query document. Previously, only the query document rendered the first time would be used for the request.</li> </ul> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10660" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10660/hovercard">#10660</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/364bee98fe193a7915664c1a5b206fd52793f85a"><code>364bee98f</code></a> Thanks <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a>! - Upgrades TypeScript to v5. This change is fully backward-compatible and transparent to users.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10597" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10597/hovercard">#10597</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/8fb9d190dbf48147412517643e3e425a7d48c49c"><code>8fb9d190d</code></a> Thanks <a href="https://snyk.io/redirect/github/phryneas">@ phryneas</a>! - Fix a bug where an incoming cache update could prevent future updates from the active link.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10629" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10629/hovercard">#10629</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/02605bb3c9e148bf87a6e52b4a9ecc7d523ef9f6"><code>02605bb3c</code></a> Thanks <a href="https://snyk.io/redirect/github/phryneas">@ phryneas</a>! - <code>useQuery</code>: delay unsubscribe to fix race conditions</p> </li> </ul> </li> <li> <b>3.7.10</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.10">2023-03-02</a></br><h3>Patch Changes</h3> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/9438" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/9438/hovercard">#9438</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/52a9c8ea1ac08ee53fe1ddbd4ded899ea00a1f9f"><code>52a9c8ea1</code></a> Thanks <a href="https://snyk.io/redirect/github/dciesielkiewicz">@ dciesielkiewicz</a>! - Ensure the <code>client</code> option passed to <code>useMutation</code>'s execute function is used when provided. Previously this option was ignored.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/9124" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/9124/hovercard">#9124</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/975b923c0c0e7ddc8553917a91981e9f41713bc1"><code>975b923c0</code></a> Thanks <a href="https://snyk.io/redirect/github/andrebrantom">@ andrebrantom</a>! - Make <code>ApolloClient.writeQuery</code> and <code>ApolloClient.writeFragment</code> behave more like <code>cache.writeQuery</code> and <code>cache.writeFragment</code> by returning the reference returned by the cache.</p> </li> </ul> </li> <li> <b>3.7.9</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.9">2023-02-17</a></br><h3>Patch Changes</h3> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10560" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10560/hovercard">#10560</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/a561ecf4306c56770ba0713f0136174275887f1a"><code>a561ecf43</code></a> Thanks <a href="https://snyk.io/redirect/github/benjamn">@ benjamn</a>! - Keep <code>__typename</code> fragment when it does not contain <code>@ client</code> directive and strip out inline fragments which use a <code>@ client</code> directive. Thanks <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Gazler/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/Gazler">@ Gazler</a> and <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mtsmfm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/mtsmfm">@ mtsmfm</a>!</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10560" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10560/hovercard">#10560</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/251a12806d1fa38bc8723540fb2d696c39db1097"><code>251a12806</code></a> Thanks <a href="https://snyk.io/redirect/github/benjamn">@ benjamn</a>! - Refactor <code>removeDirectivesFromDocument</code> to fix AST ordering sensitivities and avoid 1/3 AST traversals, potentially improving performance for large queries</p> </li> </ul> </li> <li> <b>3.7.8</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.8">2023-02-15</a></br><h3>Patch Changes</h3> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/7555" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/7555/hovercard">#7555</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/45562d6fa20eab658bd86d79d092862ace4e1225"><code>45562d6fa</code></a> Thanks <a href="https://snyk.io/redirect/github/TheCeloReis">@ TheCeloReis</a>! - Adds <code>TVariables</code> generic to <code>GraphQLRequest</code> and <code>MockedResponse</code> interfaces.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10526" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10526/hovercard">#10526</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/1d13de4f190150e96d61a9e987274ee6c249dbef"><code>1d13de4f1</code></a> Thanks <a href="https://snyk.io/redirect/github/benjamn">@ benjamn</a>! - Tolerate undefined <code>concast.sources</code> if <code>complete</code> called earlier than <code>concast.start</code></p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10497" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10497/hovercard">#10497</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/8a883d8a1c8899f94a3e2ae09cb2069bde2b2150"><code>8a883d8a1</code></a> Thanks <a href="https://snyk.io/redirect/github/nevir">@ nevir</a>! - Update <code>SingleExecutionResult</code> and <code>IncrementalPayload</code>'s <code>data</code> types such that they no longer include <code>undefined</code>, which was not a valid runtime value, to fix errors when TypeScript's <code>exactOptionalPropertyTypes</code> is enabled.</p> </li> </ul> </li> <li> <b>3.7.7</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.7">2023-02-03</a></br><h3>Patch Changes</h3> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10502" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10502/hovercard">#10502</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/315faf9ca5b326852919ab7fc2082d6ba92bcb59"><code>315faf9ca</code></a> Thanks <a href="https://snyk.io/redirect/github/jerelmiller">@ jerelmiller</a>! - Log a warning to the console when a mock passed to <code>MockedProvider</code> or <code>MockLink</code> cannot be matched to a query during a test. This makes it easier to debug user errors in the mock setup, such as typos, especially if the query under test is using an <code>errorPolicy</code> set to <code>ignore</code>, which makes it difficult to know that a match did not occur.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10499" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10499/hovercard">#10499</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/9e54f5dfa05fd363e534c432ba8c569bb96a6e35"><code>9e54f5dfa</code></a> Thanks <a href="https://snyk.io/redirect/github/phryneas">@ phryneas</a>! - Allow the execution function returned by <code>useLazyQuery</code> to change the query.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10362" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10362/hovercard">#10362</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/14a56b105fefcbb2ce5daa9fd6924e5decafcc16"><code>14a56b105</code></a> Thanks <a href="https://snyk.io/redirect/github/mccraveiro">@ mccraveiro</a>! - Fix error when server returns an error and we are also querying for a local field</p> </li> </ul> </li> <li> <b>3.7.6</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.6">2023-01-31</a></br><h3>Patch Changes</h3> <ul> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10470" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10470/hovercard">#10470</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/47435e879ebc867d9fc3de5b6fd5785204b4dbd4"><code>47435e879</code></a> Thanks <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a>! - Bumps TypeScript to <code>4.9.4</code> (previously <code>4.7.4</code>) and updates types to account for changes in TypeScript 4.8 by <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#unconstrained-generics-no-longer-assignable-to" rel="nofollow">propagating contstraints on generic types</a>. Technically this makes some types stricter as attempting to pass <code>null|undefined</code> into certain functions is now disallowed by TypeScript, but these were never expected runtime values in the first place.<br> This should only affect you if you are wrapping functions provided by Apollo Client with your own abstractions that pass in their generics as type arguments, in which case you might get an error like <code>error TS2344: Type 'YourGenericType' does not satisfy the constraint 'OperationVariables'</code>. In that case, make sure that <code>YourGenericType</code> is restricted to a type that only accepts objects via <code>extends</code>, like <code>Record<string, any></code> or <code>@ apollo/client</code>'s <code>OperationVariables</code>:</li> </ul> <div class="highlight highlight-source-diff notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { QueryHookOptions, QueryResult, useQuery, + OperationVariables, } from '@ apollo/client'; - export function useWrappedQuery<T, TVariables>( + export function useWrappedQuery<T, TVariables extends OperationVariables>( query: DocumentNode, queryOptions: QueryHookOptions<T, TVariables> ): QueryResult<T, TVariables> { const [execute, result] = useQuery<T, TVariables>(query); }"><pre>import { QueryHookOptions, QueryResult, useQuery, <span class="pl-mi1"><span class="pl-mi1">+</span> OperationVariables,</span> } from '@ apollo/client'; <span class="pl-md"><span class="pl-md">-</span> export function useWrappedQuery<T, TVariables>(</span> <span class="pl-mi1"><span class="pl-mi1">+</span> export function useWrappedQuery<T, TVariables extends OperationVariables>(</span> query: DocumentNode, queryOptions: QueryHookOptions<T, TVariables> ): QueryResult<T, TVariables> { const [execute, result] = useQuery<T, TVariables>(query); }</pre></div> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10408" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10408/hovercard">#10408</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/55ffafc585e9eb66314755b4f40804b8b8affb13"><code>55ffafc58</code></a> Thanks <a href="https://snyk.io/redirect/github/zlrlo">@ zlrlo</a>! - fix: modify BatchHttpLink to have a separate timer for each different batch key</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/9573" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/9573/hovercard">#9573</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/4a4f48dda8dd290ef110aed9e4e73d0c1c977c31"><code>4a4f48dda</code></a> Thanks <a href="https://snyk.io/redirect/github/vladar">@ vladar</a>! - Improve performance of local resolvers by only executing selection sets that contain an <code>@ client</code> directive. Previously, local resolvers were executed even when the field did not contain <code>@ client</code>. While the result was properly discarded, the unncessary work could negatively affect query performance, sometimes signficantly.</p> </li> </ul> </li> <li> <b>3.7.5</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.5">2023-01-24</a></br><h3>Patch Changes</h3> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10458" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10458/hovercard">#10458</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/b5ccef229046d230e82a68a4834ac09ae1ef2009"><code>b5ccef229</code></a> Thanks <a href="https://snyk.io/redirect/github/lennyburdette">@ lennyburdette</a>! - Passes <code>getServerSnapshot</code> to <code>useSyncExternalStore</code> so that it doesn't trigger a <code>Missing getServerSnapshot</code> error when using <code>useFragment_experimental</code> on the server.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10471" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10471/hovercard">#10471</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/895ddcb546b5692cd53caae1b604412728641374"><code>895ddcb54</code></a> Thanks <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a>! - More robust type definition for <code>headers</code> property passed to <code>createHttpLink</code></p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10321" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10321/hovercard">#10321</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/bbaa3ef2d95a03e2453ef86a25096c314fbd8998"><code>bbaa3ef2d</code></a> Thanks <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a>! - Refetch should not return partial data with <code>errorPolicy: none</code> and <code>notifyOnNetworkStatusChange: true</code>.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10402" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10402/hovercard">#10402</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/0b07aa955bab2e929f21590b565507a66f930539"><code>0b07aa955</code></a> Thanks <a href="https://snyk.io/redirect/github/Hugodby">@ Hugodby</a>! - Improve context types</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10469" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10469/hovercard">#10469</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/328c58f90d3fd985a58a68d8ba07f7c03f9808f6"><code>328c58f90</code></a> Thanks <a href="https://snyk.io/redirect/github/jerelmiller">@ jerelmiller</a>! - Add generic type defaults when using <code>useFragment</code> to allow passing <code>TData</code> directly to the function without needing to specify <code>TVars</code>.</p> </li> </ul> </li> <li> <b>3.7.4</b> - 2023-01-13 </li> <li> <b>3.7.3</b> - 2022-12-15 </li> <li> <b>3.7.2</b> - 2022-12-06 </li> <li> <b>3.7.1</b> - 2022-10-20 </li> <li> <b>3.7.0</b> - 2022-09-30 </li> </ul> from <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases">@apollo/client GitHub release notes</a> </details> </details> <details> <summary><b>Commit messages</b></summary> </br> <details> <summary>Package name: <b>@apollo/client</b></summary> <ul> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/9e4d72c8be5fa8b1faeaee801fdb92ab9a503dc1">9e4d72c</a> Version Packages (#10811)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/1e8a86ca70784731bcd736d680589cabd1dfaa6e">1e8a86c</a> fix: release workflow also needs pull-requests: write permissions (#10816)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/f45cde6094cb0fde9e426a7167681112a2fb54f5">f45cde6</a> fix: add permissions contents: read in release workflow (#10815)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/1ae0d406fd6f7823391a62f7a1cc9d640a51ab5d">1ae0d40</a> chore: generate npm provenance statements (#10814)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/577c68bdd26519f8341fd1188ea4b8aabe357856">577c68b</a> useSubscription: keep subscription Concast alive if new in-flight subscription subscribes at the same time last in-flight subscription unsubscribes (#10718)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/a5503666c2cc8220ac1d877e3296556e54e58ff6">a550366</a> fix `persistedQuery` memory leak in SSR scenarios (#10805)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/fdd0c5bcc05894f52879161361f0b38fc69c0cbc">fdd0c5b</a> Remove note about `setVariables` being an internal API (#10790)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/72dccb1e2e5e5aab698e5206a3ed4e8760276bca">72dccb1</a> chore(deps): update dependency @ types/react to v18.2.0 (#10795)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/e4f3bad6e6f90a2803eb611c2364c1cc1d16a2a6">e4f3bad</a> chore(deps): update dependency @ typescript-eslint/parser to v5.59.1 (#10797)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/fa570f2b5f4888031962583d18b40039fdf9bb70">fa570f2</a> chore(deps): update dependency @ typescript-eslint/eslint-plugin to v5.59.0 (#10796)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/65a9d79f9054306e2d07a727eb6b06b1eb21afcd">65a9d79</a> chore(deps): update dependency @ types/node to v18.16.0 (#10794)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/31202dae9992c2ec8d011ade016ade0dab0e4eda">31202da</a> chore(deps): update dependency @ types/jest to v29.5.1 (#10793)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/52fbe3ce6288b57b1102c294beb1a439f5225cce">52fbe3c</a> chore(deps): update dependency eslint to v8.39.0 (#10798)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/dd8d8d6f31dea8c9648fc366b0be797960a12169">dd8d8d6</a> chore(deps): update dependency terser to v5.17.1 (#10799)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/f2a4684874f2896d4b54176834b3660368989cc7">f2a4684</a> chore(deps): update cimg/node docker tag to v20 (#10800)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/4f4e4ba85f672fb5da71cb746c49013e103f6cfc">4f4e4ba</a> chore(deps): update dependency @ graphql-tools/schema to v9.0.19 (#10801)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/8e26ed6f438907267c6f7a9c269008362838ad2f">8e26ed6</a> docs: adds `createFragmentRegistry` (#10780)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/499701310fd244877f35067c35ad0eae5dc7be70">4997013</a> chore(deps): update dependency @ typescript-eslint/eslint-plugin to v5.58.0 (#10778)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/35f4dfd2dbdf8b6f1cbf41ce9f9e6bdadd3e764e">35f4dfd</a> chore(deps): update dependency terser to v5.16.9 (#10776)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/acee7a17b6d8ffb896863d6b658fd8b28ee4a3bb">acee7a1</a> chore(deps): update dependency jest-junit to v16 (#10779)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/116ed42872007cd0aa7611fc47e7b1dd9dbcdde6">116ed42</a> chore(deps): update dependency @ graphql-tools/schema to v9.0.18 (#10771)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/4b3145f944b9b875ea9db95903501b952984a75f">4b3145f</a> chore(deps): update cimg/node docker tag to v19.9.0 (#10777)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/75343945b861ef8a47bf718a5bbfab3e2f47ca57">7534394</a> chore(deps): update dependency @ types/lodash to v4.14.194 (#10772)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/03a20af8e43e9ca6111b1508badef92eca48b2bd">03a20af</a> chore(deps): update dependency @ types/react to v18.0.35 (#10773)</li> </ul> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/compare/9134aaf3b6fc398b2d82439b5b63848b533ae4c9...9e4d72c8be5fa8b1faeaee801fdb92ab9a503dc1">Compare</a> </details> </details> <hr/> **Note:** *You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.* For more information: <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI1ZjYxMWYyMC0xYjNkLTRiMDItYWMxMS1hOTgxODdlNmIyNTEiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjVmNjExZjIwLTFiM2QtNGIwMi1hYzExLWE5ODE4N2U2YjI1MSJ9fQ==" width="0" height="0"/> 🧐 [View latest project report](https://app.snyk.io/org/satt/project/b89486be-ad07-4d6c-a51a-2fa8a25baa00?utm_source=github&utm_medium=referral&page=upgrade-pr) 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/satt/project/b89486be-ad07-4d6c-a51a-2fa8a25baa00/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/satt/project/b89486be-ad07-4d6c-a51a-2fa8a25baa00/settings/integration?pkg=@apollo/client&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) <!--- (snyk:metadata:{"prId":"5f611f20-1b3d-4b02-ac11-a98187e6b251","prPublicId":"5f611f20-1b3d-4b02-ac11-a98187e6b251","dependencies":[{"name":"@apollo/client","from":"3.7.0","to":"3.7.13"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/satt/project/b89486be-ad07-4d6c-a51a-2fa8a25baa00?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"b89486be-ad07-4d6c-a51a-2fa8a25baa00","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":13,"publishedDate":"2023-04-27T21:31:10.640Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]}) --->
Checklist:
This PR attempts to address the
useSubscription
React hook issue outlined in #10695. It is also related to #10693 but does not directly address it outside of the case in which unsubscription and resubscription to the same subscription observable happens in the same frame.