DEV Community

Discussion on: How do you handle breaking changes with GraphQL?

Collapse
 
tjoskar profile image
Oskar Karlsson

Thanks for your reply!

To refetch data after a mutation are a valid solution but it would be nice to fetch the data in the same mutation-request instead of making an extra one, especially when it comes to GraphQL which is all about query data.

Having said that; I just read the spec and it states that one can only make either a query or a mutation request, not both at the same time, and having that stated I only see two solutions: 1. making an extra query (as you suggested) or creating a wrapper type (as described above with the CreateCommentResponse-type).

I guess all mutation could always return the root Query-type to make it possible to query any data after the mutation 🤔 But I think I will just return the changed data to keep it simple.

Collapse
 
itsjzt profile image
Saurabh Sharma

You idea is nice, I think it can work.

Other way is to update the local cache accordingly which means you dont have to query the new data from server apollographql.com/docs/react/cachi...