-
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
Design to bring common variable change tracking functionality into QueryObservable
#554
Comments
I'm not sure if this is the best format to take comments, but I've assigned people to the issue that I think will be interested. Let's try adding comments here. If you don't have anything to say and just want to sign off on it, I guess just 👍 the original comment. |
We've already implemented this in It could be even simpler, but we need to support the old observable: return rxify(this.client.watchQuery)(options); |
Following up on #513, here is a "lowest common denominator" design for bringing common logic into Apollo Client Core.
Goals:
{ loading: true }
) without having to track it themselves.props
).[It's debatable that all of these goals are valuable]
Non-goals:
[1] The React integration API doesn't let you change queries, and it doesn't look like the Angular integration encourages you to either. This could be controversial? (of course this design allows the integration to unsubscribe and re-query if it wants)
Design
It seems the above can be achieved in a straightforward fashion by extending the
QueryObservable
API.To achieve 1:
If a
QueryObservable
tracks the previous values of variables, we could have an API like:To achieve 2:
Add:
To achieve 3 + 4:
Add and option to relevant methods
client.watchQuery()
,observable.refetch()
,client.mutate
etcallowSuperfluousVariables
that allows integrations to blindly pass things like{ ...ownProps, ...userVariables }
into a call without needing to figure out which ofownProps
are relevant.The text was updated successfully, but these errors were encountered: