-
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
Abort in-flight promises returned from useLazyQuery
when component unmounts
#10427
Conversation
🦋 Changeset detectedLatest commit: 33d2ef2 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 |
905ba37
to
06f8723
Compare
useLazyQuery
when component unmounts
@@ -1,7 +1,7 @@ | |||
import React from 'react'; | |||
import { GraphQLError } from 'graphql'; | |||
import gql from 'graphql-tag'; | |||
import { renderHook, waitFor } from '@testing-library/react'; | |||
import { act, renderHook, waitFor } from '@testing-library/react'; |
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.
If this is working in both React 17 + 18, ignore this comment 😄 Just noting I was seeing test failures when I tried moving the act
import to RTL from react-dom/test-utils
in a few tests that run against both versions.
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.
Interesting. I just rebased main
and this seems to work just fine, so I think we are good!
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.
✅
e89f516
to
33d2ef2
Compare
@jerelmiller Have you tested this with using suspense boundaries? My error boundary is catching the abort action and won't render the resource's data since the suspense boundary is un-mounting the component that is trying to render the data even if the suspender is still resolving. |
Hey @christiancho 👋 See my comment in #10520 (comment) for the reason I chose to let the promise reject without catching it inside |
@jerelmiller Thanks for the insight! We'll have to work around it. |
@christiancho no problem! As mentioned in that comment, just ensure your If you use a lot of import { useLazyQuery as useApolloLazyQuery } from '@apollo/client';
function useLazyQuery(...args) {
const [execute, result] = useApolloLazyQuery(...args);
async function executeWithCaughtAbortedError(...args) {
try {
return await execute(...args);
} catch (error) {
if (error.name === 'AbortError') {
return // do nothing if aborted
}
throw error
}
}
return [executeWithCaughtAbortedError, result]
} That being said, I wouldn't expect you to have to write this code super often as it should only be needed in components that have the ability to unmount while the request is in-flight. That is unless you have a lot of components that have a tendency to unmount 😄. Hope this helps! |
The problem with this is that when suspending, the request gets aborted immediately, so the promise never resolves successfully. Here's the wrapper we're using for suspending the promise so the boundary can catch it:
|
@christiancho right... suspense.... Let me think about this some more. I hadn't anticipated this being used in conjunction with a custom suspense solution. Would you be willing to open a new issue in regards to this behavior? I'd love to track this separately. |
<h3>Snyk has created this PR to upgrade @apollo/client from 3.7.0 to 3.7.7.</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 **7 versions** ahead of your current version. - The recommended version was released **a month ago**, on 2023-02-03. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>@apollo/client</b></summary> <ul> <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> <p><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.</p> </li> <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> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.4">2023-01-13</a></br><h3>Patch Changes</h3> <ul> <li> <p><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> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/28d909cff086f8352e2ea75421a1cac590917573"><code>28d909cff</code></a> Thanks <a href="https://snyk.io/redirect/github/jerelmiller">@ jerelmiller</a>! - Ensure in-flight promises executed by <code>useLazyQuery</code> are rejected when <code>useLazyQuery</code> unmounts.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10383" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10383/hovercard">#10383</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/5c5ca9b01a2b9905f94de85e5b80ffc29522e2e3"><code>5c5ca9b01</code></a> Thanks <a href="https://snyk.io/redirect/github/jerelmiller">@ jerelmiller</a>! - Ensure the <code>onError</code> callback is called when the <code>errorPolicy</code> is set to "all" and partial data is returned.</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10425" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10425/hovercard">#10425</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/86e35a6d25e9838f39a9de652e52a358b9c08488"><code>86e35a6d2</code></a> Thanks <a href="https://snyk.io/redirect/github/jerelmiller">@ jerelmiller</a>! - Prefer the <code>onError</code> and <code>onCompleted</code> callback functions passed to the execute function returned from <code>useMutation</code> instead of calling both callback handlers.</p> </li> </ul> </li> <li> <b>3.7.3</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.3">2022-12-15</a></br><h3>Patch Changes</h3> <ul> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10334" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10334/hovercard">#10334</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/7d923939dd7e6db7d69f04f598c666104b076e78"><code>7d923939d</code></a> Thanks <a href="https://snyk.io/redirect/github/jerelmiller">@ jerelmiller</a>! - Better handle deferred queries that have cached or partial cached data for them</p> </li> <li> <p><a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10368" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10368/hovercard">#10368</a> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/46b58e9762abbffaee5c9abda8e309bea6d7a785"><code>46b58e976</code></a> Thanks <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a>! - Fix: unblocks support for defer in mutations</p> <p>If the <code>@ defer</code> directive is present in the document passed to <code>mutate</code>, the Promise will resolve with the final merged data after the last multipart chunk has arrived in the response.</p> </li> </ul> </li> <li> <b>3.7.2</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.2">2022-12-06</a></br><a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.2"> Read more </a> </li> <li> <b>3.7.1</b> - <a href="https://snyk.io/redirect/github/apollographql/apollo-client/releases/tag/v3.7.1">2022-10-20</a></br><h2>Bug fixes (from <a href="https://snyk.io/redirect/github/apollographql/apollo-client/blob/main/CHANGELOG.md"><code>CHANGELOG.md</code></a>)</h2> <ul> <li> <p>Fix issue where <code>loading</code> remains <code>true</code> after <code>observer.refetch</code> is called repeatedly with different variables when the same data are returned.<br> <a href="https://snyk.io/redirect/github/alessbell">@ alessbell</a> in <a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10143" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10143/hovercard">#10143</a></p> </li> <li> <p>Fix race condition where <code>useFragment_experimental</code> could receive cache updates before initially calling <code>cache.watch</code> in <code>useEffect</code>.<br> <a href="https://snyk.io/redirect/github/benjamn">@ benjamn</a> in <a href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10212" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10212/hovercard">#10212</a></p> </li> </ul> <h2>What's Changed (auto-generated by GitHub)</h2> <ul> <li>changes install message by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jpvajda/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/jpvajda">@ jpvajda</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1392871877" data-permission-text="Title is private" data-url="apollographql/apollo-client#10149" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10149/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10149">#10149</a></li> <li>oct 2022 roadmap update by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jpvajda/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/jpvajda">@ jpvajda</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1395355230" data-permission-text="Title is private" data-url="apollographql/apollo-client#10161" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10161/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10161">#10161</a></li> <li>Small updates for AS4 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rkoron007/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/rkoron007">@ rkoron007</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1405252320" data-permission-text="Title is private" data-url="apollographql/apollo-client#10175" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10175/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10175">#10175</a></li> <li>Various edits to caching docs by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/StephenBarlow/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/StephenBarlow">@ StephenBarlow</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1327921835" data-permission-text="Title is private" data-url="apollographql/apollo-client#9984" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/9984/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/9984">#9984</a></li> <li>Use nav nesting and tweak defer article slightly by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/StephenBarlow/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/StephenBarlow">@ StephenBarlow</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1406849387" data-permission-text="Title is private" data-url="apollographql/apollo-client#10187" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10187/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10187">#10187</a></li> <li>Call <code>iterateObserversSafely</code> if vars change between calls to <code>observer.next</code> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alessbell/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/alessbell">@ alessbell</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1390000591" data-permission-text="Title is private" data-url="apollographql/apollo-client#10143" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10143/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10143">#10143</a></li> <li>Update docs algolia filters by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/trevorblades/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/trevorblades">@ trevorblades</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1412233303" data-permission-text="Title is private" data-url="apollographql/apollo-client#10200" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10200/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10200">#10200</a></li> <li>Fix typo in <code>NetworkError</code> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/OliverWales/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/OliverWales">@ OliverWales</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1413281725" data-permission-text="Title is private" data-url="apollographql/apollo-client#10204" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10204/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10204">#10204</a></li> <li>Update apollo-link-rest.md - Add graphql-anywhere to install list by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pfcodes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/pfcodes">@ pfcodes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1388851953" data-permission-text="Title is private" data-url="apollographql/apollo-client#10138" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10138/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10138">#10138</a></li> <li>Use custom <code>config/bundlesize.ts</code> script to avoid <code>iltorb</code> dependency, unbreaking <code>npm install</code> when using Node.js v19 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/benjamn/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/benjamn">@ benjamn</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1413880266" data-permission-text="Title is private" data-url="apollographql/apollo-client#10206" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10206/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10206">#10206</a></li> <li>Experiment with not caching the <code>~/.npm</code> directory during Filesize/Tests CircleCI jobs by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/benjamn/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/benjamn">@ benjamn</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1414934448" data-permission-text="Title is private" data-url="apollographql/apollo-client#10209" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10209/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10209">#10209</a></li> <li>docs: add TypedDocumentNode example by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/henryqdineen/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/henryqdineen">@ henryqdineen</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1348527109" data-permission-text="Title is private" data-url="apollographql/apollo-client#10031" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10031/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10031">#10031</a></li> <li>Update Local Resolvers docs by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/bignimbus/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/bignimbus">@ bignimbus</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1415203893" data-permission-text="Title is private" data-url="apollographql/apollo-client#10211" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10211/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10211">#10211</a></li> <li>Remove (deprecated) from Local resolvers doc title by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/bignimbus/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/bignimbus">@ bignimbus</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1415475621" data-permission-text="Title is private" data-url="apollographql/apollo-client#10213" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10213/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10213">#10213</a></li> <li>Remaining Local Resolvers wordsmithing by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/bignimbus/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/bignimbus">@ bignimbus</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1415559784" data-permission-text="Title is private" data-url="apollographql/apollo-client#10214" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10214/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10214">#10214</a></li> <li>Call <code>forceUpdate</code> immediately if <code>diff</code> changes between first <code>useFragment</code> call and first <code>cache.watch</code> call by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/benjamn/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/benjamn">@ benjamn</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1415441975" data-permission-text="Title is private" data-url="apollographql/apollo-client#10212" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10212/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10212">#10212</a></li> </ul> <h2>New Contributors (auto-generated by GitHub)</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/OliverWales/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/OliverWales">@ OliverWales</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1413281725" data-permission-text="Title is private" data-url="apollographql/apollo-client#10204" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10204/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10204">#10204</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pfcodes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/pfcodes">@ pfcodes</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1388851953" data-permission-text="Title is private" data-url="apollographql/apollo-client#10138" data-hovercard-type="pull_request" data-hovercard-url="/apollographql/apollo-client/pull/10138/hovercard" href="https://snyk.io/redirect/github/apollographql/apollo-client/pull/10138">#10138</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/apollographql/apollo-client/compare/v3.7.0...v3.7.1"><tt>v3.7.0...v3.7.1</tt></a></p> </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/676e11edd57ab2582b49bf1d1b6dc921df7213cf">676e11e</a> Version Packages (#10501)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/e079cc1ad31dae9831dbd13a6e7636384e48e9e9">e079cc1</a> Remove unused reject argument for mockQueryManager and mockWatchQuery (#10504)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/315faf9ca5b326852919ab7fc2082d6ba92bcb59">315faf9</a> Log unmatched mocks to the console for tests (#10502)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/14a56b105fefcbb2ce5daa9fd6924e5decafcc16">14a56b1</a> fix: error when server throws and we are also querying for a local field (#10362)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/8ac151e6e3f6aaf4a2facb44cff81be7104f066c">8ac151e</a> Welcome, Lenz!</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/9e54f5dfa05fd363e534c432ba8c569bb96a6e35">9e54f5d</a> Allow `useLazyQuery` trigger fn to change `query` (#10499)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/2408fd3fe7259ebf8bd5c90b67ec71ce4124180d">2408fd3</a> chore: adds GHA workflow to lock closed + dormant issues (#10500)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/9f0e298fe44d00dd8189e3393142af654ec08b3c">9f0e298</a> Version Packages (#10479)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/b4a4bd16a911a233de6ada47780c84512f885401">b4a4bd1</a> Add more details to the roadmap (#10494)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/4a4f48dda8dd290ef110aed9e4e73d0c1c977c31">4a4f48d</a> Fields without `@ client` directive should not be resolved locally (#9573)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/43f3a54427512cfa3413ddf10738bf63bec84b15">43f3a54</a> chore(deps): update dependency eslint to v8.33.0</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/8f56cc46afee65110793ee262643b0b9fa9f6439">8f56cc4</a> chore(deps): update dependency eslint-plugin-testing-library to v5.10.0</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/154d8acda95c8e16f0ad3714b4229f373dd16351">154d8ac</a> chore(deps): update dependency @ typescript-eslint/parser to v5.49.0</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/ca852c2c446ab5f086723cfc015f02cc0db4d444">ca852c2</a> chore(deps): update dependency @ typescript-eslint/eslint-plugin to v5.49.0</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/97848726b3242bfc5e604c792d251334b8fcce8d">9784872</a> chore(deps): update cimg/node docker tag to v19.5.0</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/7db773d8fabfade6968250ca00a2bb5805336a4b">7db773d</a> chore(deps): update dependency rimraf to v4.1.2</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/0ff17bece2a32b68a155771f59dfe0e05373173c">0ff17be</a> chore(deps): update dependency acorn to v8.8.2</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/13f1bbb36eb67327bfc7909781f6ebb62aed413d">13f1bbb</a> chore(deps): update dependency @ graphql-tools/schema to v9.0.14</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/8a7fb6f9da34c09b02f30878b8a90bc572160e7a">8a7fb6f</a> chore: adds changeset snapshot release action (#10480)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/55ffafc585e9eb66314755b4f40804b8b8affb13">55ffafc</a> fix: modify the BatchHttpLink to have each timer when the batch key is different (#10408)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/47435e879ebc867d9fc3de5b6fd5785204b4dbd4">47435e8</a> Upgrade to TypeScript 4.9 (#10470)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/d8f28c3da80ff898d11c636d8b688e6d471432fa">d8f28c3</a> Remove errant JSON.parse statement in docs (#10476)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/49ffcfab0165dc61a7475b2e18f0ecae00f7c22c">49ffcfa</a> Version Packages (#10456)</li> <li><a href="https://snyk.io/redirect/github/apollographql/apollo-client/commit/895ddcb546b5692cd53caae1b604412728641374">895ddcb</a> Fix headers type (extends #9042) (#10471)</li> </ul> <a href="https://snyk.io/redirect/github/apollographql/apollo-client/compare/9134aaf3b6fc398b2d82439b5b63848b533ae4c9...676e11edd57ab2582b49bf1d1b6dc921df7213cf">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=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJhZjM3YzJmNi1kZDgwLTRlNjEtYWNiNi0xOGQwYWI4YzVjNDEiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImFmMzdjMmY2LWRkODAtNGU2MS1hY2I2LTE4ZDBhYjhjNWM0MSJ9fQ==" width="0" height="0"/> 🧐 [View latest project report](https://app.snyk.io/org/mergestat/project/e267d993-52da-4f6e-9de9-0012cd8b1835?utm_source=github&utm_medium=referral&page=upgrade-pr) 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/mergestat/project/e267d993-52da-4f6e-9de9-0012cd8b1835/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/mergestat/project/e267d993-52da-4f6e-9de9-0012cd8b1835/settings/integration?pkg=@apollo/client&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) <!--- (snyk:metadata:{"prId":"af37c2f6-dd80-4e61-acb6-18d0ab8c5c41","prPublicId":"af37c2f6-dd80-4e61-acb6-18d0ab8c5c41","dependencies":[{"name":"@apollo/client","from":"3.7.0","to":"3.7.7"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/mergestat/project/e267d993-52da-4f6e-9de9-0012cd8b1835?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"e267d993-52da-4f6e-9de9-0012cd8b1835","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":7,"publishedDate":"2023-02-03T18:24:55.814Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]}) --->
Closes #10365
Ensure in-flight promises returned from
useLazyQuery
's execute function are aborted whenuseLazyQuery
unmounts. Currently the promise is stuck in a pending state indefinitely with no way to resolve/reject it.Checklist: