relay-tools / relay-subscriptions

[Deprecated] Subscription support for Relay Classic

Home Page:https://facebook.github.io/relay/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get rid of $input

edvinerikson opened this issue · comments

When using arguments in subscriptions you need to use $input argument instead of passing arguments separate.
This behavior comes from mutations and I'm not sure what the tradeoffs are to get rid of it or if it is even possible without modifying the babel plugin.

How I know, it just Relay architectural solution. Graphql and babel-plugin do not have such restriction.
So if you ommit this wrap field, your subscriptions and relay mutations will have different symantics. So on server side we lost ability to reuse some resolve function from mutation. That just trade-off.

My opinion we should keep this field, while working under Relay, due relay arch design.

Thanks for the input on this @nodkz. Yeah I also think that it might be easier to keep the field as is. 👍

How do I get around this?

babel-relay-plugin won't transform my subscription. getting ..., but mutation fields must have exactly one argument namedinput``

I just need to have an input{clientMutationId:ID!} defined on my Subscription fields

@trbngr You will need to define $input on your subscription and you should be fine.

I got it figured out. Great job on the abstraction, man!

https://www.youtube.com/watch?v=93kVJN8Utjc