The purpose of a selection set in mutations is to be able to retrieve data that has changed as a result of the mutation. But it also allows you to get related data, as long as you can access through the result of the mutation result.
Suppose we have the following types:
type Address { city: String } type User { addresses: [Address] }
If the result type (payload) of the login mutation includes a viewer field of type User , which refers to a successfully registered user, you can request any User field as a result of the mutation:
mutation { login(credentials: { email: " me@me.com ", password: "password123", passwordConfirmation: "password123" }) { viewer { addresses { city } } } }
source share