You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to have a bit more API surface to make a nicer API for consuming libraries. Sometimes you'd want to set up a mutation, and provide the variables dynamically. For instance with react-apollo a hook that returns a function that accepts variables. Because the make functions needs the variables, we cannot get back the data structure that includes the mutation itself and the parse function.
A workaround for now is to
pass the whole make function at the last moment and initially create an empty mutation in the hook.
Pass the query attribute and parse method to the hook and the variables attribute of make later.
Both not great options. I would propose a makeVariables function to make the variables data structure, and a makeMutation (better naming ideas?) that does the same thing as make but returns the data structure without variables. Any thoughts?
Happy to try to set up a PR for this, but interested in feedback on this first.
The text was updated successfully, but these errors were encountered:
I think there is only a need to expose makeVariables function. make result is just a reexport or query and parse with created variables. You have access to query and parse all the time.
I think it should be fairly easy to implement. I'm open to PR 🙂 Let men know if you need some help.
It would be great to have a bit more API surface to make a nicer API for consuming libraries. Sometimes you'd want to set up a mutation, and provide the variables dynamically. For instance with react-apollo a hook that returns a function that accepts variables. Because the
make
functions needs the variables, we cannot get back the data structure that includes the mutation itself and the parse function.A workaround for now is to
make
function at the last moment and initially create an empty mutation in the hook.query
attribute andparse
method to the hook and thevariables
attribute ofmake
later.Both not great options. I would propose a
makeVariables
function to make the variables data structure, and amakeMutation
(better naming ideas?) that does the same thing asmake
but returns the data structure without variables. Any thoughts?Happy to try to set up a PR for this, but interested in feedback on this first.
The text was updated successfully, but these errors were encountered: