-
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
Fix useSubscription
executes skipped subscription if input changes
#9299
Conversation
@levrik: 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/ |
useSubscription
executing skipped subscription if input changes
useSubscription
executing skipped subscription if input changesuseSubscription
executes skipped subscription if input changes
554ab6b
to
c4a0a40
Compare
Rebased on |
@levrik This is wonderful, though I might need to double check the |
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.
2fce2d6
to
e7c0bbf
Compare
Checklist:
This bug triggered a regression in our application after updating from Apollo Client 3.3.21 to 3.5.7.
The unit test testing the
skip
flag wasn't actually working correctly. It didn't fail whenskip
was set tofalse
.I've updated it to make sure no subscription is being executed by spying on
onSetup
callback of the link instead of theonSubscriptionData
one on the hook which isn't called anyway sincesimulateResult
isn't called as part of the test. I also extended the test to make sure no subscription is being executed when variables are changing.The final version of the test was verified to fail on
main
branch.I wasn't sure if I shall extend the existing test or add a new one. Let me know if a new test case for the update case is preferred.