Closed dustinfarris closed 7 years ago
Right you are! This is a point of frustration for me with GraphQL. If the mutation is supposed to return type X, you need to request type X from it. Right now, cashay does that for you by looking at your mutation handlers and writing the mutation for you. Even though this is great, prevents under/over fetching, human error etc, it does feel unnatural for some requests. I'm thinking about rewriting the mutations API so the mutation handlers are on the mutation itself and the fetched fields are user defined. That could result in a little more over fetching, but removes the magic. If you have any thoughts I'd love to hear em!
On Dec 1, 2016 10:41 AM, "Dustin Farris" notifications@github.com wrote:
Got this error doing a simple:
cashay.mutate('createProject', { variables: { name } });
I think it is probably because I don't have any mutation handlers set up yet. If that is the case perhaps this error could be trapped and rewritten.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mattkrick/cashay/issues/141, or mute the thread https://github.com/notifications/unsubscribe-auth/AFQjv0FRQ62XQvlIYYRJtVXCjgk_EOL8ks5rDxTJgaJpZM4LBvmO .
It feels like having mutation-related stuff isolated to the mutation call would make more sense. But as a newcomer, I am just scratching the surface in terms of applicability—so it's hard to weight pros/cons. I am starting to understand the benefit of the intersection of related queried fields. It would be a lot of fields to keep track of as the app grows I imagine.
But for your reference, my first thought was, "I want to do a mutation. Why do I have to mess with my queries?"
On Dec 1, 2016, at 3:08 PM, Matt Krick notifications@github.com wrote:
Right you are! This is a point of frustration for me with GraphQL. If the mutation is supposed to return type X, you need to request type X from it. Right now, cashay does that for you by looking at your mutation handlers and writing the mutation for you. Even though this is great, prevents under/over fetching, human error etc, it does feel unnatural for some requests. I'm thinking about rewriting the mutations API so the mutation handlers are on the mutation itself and the fetched fields are user defined. That could result in a little more over fetching, but removes the magic. If you have any thoughts I'd love to hear em!
On Dec 1, 2016 10:41 AM, "Dustin Farris" notifications@github.com wrote:
Got this error doing a simple:
cashay.mutate('createProject', { variables: { name } });
I think it is probably because I don't have any mutation handlers set up yet. If that is the case perhaps this error could be trapped and rewritten.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mattkrick/cashay/issues/141, or mute the thread https://github.com/notifications/unsubscribe-auth/AFQjv0FRQ62XQvlIYYRJtVXCjgk_EOL8ks5rDxTJgaJpZM4LBvmO .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattkrick/cashay/issues/141#issuecomment-264280099, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCWvaRg-3ZWhQwZzGKRGwzsv2-C7A1Oks5rDykkgaJpZM4LBvmO.
-- Dustin Farris
agreed, it's a many-to-many relationship (one mutation affects many queries, one query is affected by many mutations). there isn't a clean way to do it, but there is definitely room for improvement.
Got this error doing a simple:
I think it is probably because I don't have any mutation handlers set up yet. If that is the case perhaps this error could be trapped and rewritten.