-
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
Why does subscribeToMore don't allow for different variables from the query variables? #4246
Comments
Im running into this same issue |
timhwang21
added a commit
to timhwang21/apollo-client
that referenced
this issue
Mar 20, 2019
timhwang21
added a commit
to timhwang21/apollo-client
that referenced
this issue
Mar 20, 2019
timhwang21
added a commit
to timhwang21/apollo-client
that referenced
this issue
Mar 20, 2019
timhwang21
added a commit
to timhwang21/apollo-client
that referenced
this issue
Mar 20, 2019
2 tasks
I've run into this as well, and filed a PR for it. Would be great to have this fixed! |
@timhwang21 awesome! You mind posting a link for the PR so I can follow it? EDIT: PR #4608 |
timhwang21
added a commit
to timhwang21/apollo-client
that referenced
this issue
Apr 6, 2019
timhwang21
added a commit
to timhwang21/apollo-client
that referenced
this issue
Apr 6, 2019
benjamn
pushed a commit
that referenced
this issue
Apr 8, 2019
Please try a recent version of |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm working with
react-apollo
in TS and find it frustrating that I can't add a generic type for variables to thesubscribeToMore
function, but I can passTSubscriptionData
. I'm designing subscriptions that are very generic and top-level. Take this hypothetical schemaNow, I would like to implement a custom component that could be used to query all posts or all posts by an author
I would like to subcribe to posts using the
subscribeToMore
function here. ThesubscribeToMore
function is typed like this inapollo-client
:This makes it possible to give a the type to the response, which I would expect is an object with
id
,operation
andpost
as properties. The implementation allows for thepost
subscription to be treated as a catch-all if there is no particular operation or a listener for a single event. However, if I try to do the following, it will complain because the variables type is not compatible.Is there a reason why clients are not allowed to pass custom variables as well? Is there a better option than casting
subscribeToMore
to utilize my subscription without having to make individual subscriptions for every possible operation?[email protected]
[email protected]
The text was updated successfully, but these errors were encountered: