apollo-client
apollo-client copied to clipboard
Fix useSubscription restart was not cached
This PR fixes that the useSubscription hook's definition of the recently added (#11927) restart function was not cached between rerenders (unlike other functions such as refetch and fetchMore returned by similar hooks). This made the restart unsuitable to be included in the dependency array of React.useEffect.
My use case is restarting a subscription when a React Native app is resumed from the background. @phryneas I assume it's evident from the code that restart is redefined every render. However, if you would like a reproducible, please let me know.
@DoctorJohn: 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/
Deploy Preview for apollo-client-docs ready!
| Name | Link |
|---|---|
| Latest commit | 584275321d065bc4ecaa7e463340addd14679b8a |
| Latest deploy log | https://app.netlify.com/sites/apollo-client-docs/deploys/66d739d3fda26200085f14ba |
| Deploy Preview | https://deploy-preview-12044--apollo-client-docs.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
🦋 Changeset detected
Latest commit: 584275321d065bc4ecaa7e463340addd14679b8a
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @apollo/client | Patch |
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
Great catch, thank you for the contribution! I'll clean that up a bit and get it released in a few minutes :)