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

Open
jpvajda opened this issue Oct 20, 2022 · 1 comment
Open

Add an ignoreResults option to the useSubscription API #10216

jpvajda opened this issue Oct 20, 2022 · 1 comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants