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
There's a high probability that the answer is this is possible and I'm just doing it wrong ....
I'm wondering if there's a streamlined way to use the generated types such that objects fetched via a query can be directly modified and used in a corresponding mutation without additional boilerplate.
I think a pseudocode example better demonstrates what I would assume an inherent design goal would be:
let post = useGetPost({ variables: { postId } });
post.title = 'Updated Title';
let updateResult = useUpdatePostByPK({ variables: { postId, post } });
My expectation was that the types generated by graphql-codegen would facilitate a smooth workflow where the object retrieved from GetPost could be directly manipulated and passed to UpdatePostByPK. However, I find myself needing to manually align or transform the data structures.
Is there a recommended way to achieve this seamless integration using graphql-codegen?
If not, would this be considered a reasonable feature request?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
There's a high probability that the answer is this is possible and I'm just doing it wrong ....
I'm wondering if there's a streamlined way to use the generated types such that objects fetched via a query can be directly modified and used in a corresponding mutation without additional boilerplate.
I think a pseudocode example better demonstrates what I would assume an inherent design goal would be:
posts.yml
My expectation was that the types generated by graphql-codegen would facilitate a smooth workflow where the object retrieved from GetPost could be directly manipulated and passed to UpdatePostByPK. However, I find myself needing to manually align or transform the data structures.
Beta Was this translation helpful? Give feedback.
All reactions