Skip to content
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

Add an ignoreResults option to the useSubscription API #10216

Closed
jpvajda opened this issue Oct 20, 2022 · 4 comments · Fixed by #11921
Closed

Add an ignoreResults option to the useSubscription API #10216

jpvajda opened this issue Oct 20, 2022 · 4 comments · Fixed by #11921

Comments

@jpvajda
Copy link
Contributor

jpvajda commented Oct 20, 2022

Overview

Some issues have been brought to our attention that the useSubscription API doesn't have an option of ignoreResults, similar to the useMutation API.

Issue

Unfortunately, unlike useMutation, there is no "magic parameter" like ignoreResults, and a component will be rendered each time you get new data on subscription. useSubscription returns a value, and because it does, that means we need to update it, which requires components to re-render. Whereas useMutation allows someone to avoid the re-renders by passing an ignoreResults option.

Purpose

We could offer an ignoreResults option in useSubscription which would not return a value from useSubscription thereby avoiding re-renders This would be useful to allow a developer to to not re-render a component on certain occasions if they wish.

Details

  • Name: ignoreResults
  • Type boolean
  • Functionality: If true, the subscription's data property is not updated with the subscription's result.
  • Default: false

References

@jpvajda jpvajda changed the title add ignoreResults option to the useSubscription API Add anignoreResults option to the useSubscription API Oct 20, 2022
@jpvajda jpvajda changed the title Add anignoreResults option to the useSubscription API Add an ignoreResults option to the useSubscription API Oct 20, 2022
@kjhuang-db
Copy link

+10000

@phryneas
Copy link
Member

phryneas commented Jul 8, 2024

This has been implemented in #11921 and will be released in Apollo Client 3.11.

@phryneas phryneas closed this as completed Jul 8, 2024
Copy link
Contributor

github-actions bot commented Jul 8, 2024

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

Copy link
Contributor

github-actions bot commented Aug 8, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants