Say I have a GraphQL model that has People and Parties.
Something like this:
Person {
name: String
parties: PartyConnection
}
Party {
place: String
dateTime: String
people: PeopleConnection
}
I can look at a Person and see what Parties that they are going to, which then gets cached by Relay.
I can also do a mutation to create a new party, adding some people to it. How do I ensure that everyone I have added to the party is invalidated in the cache so that when I navigate to the person's page, I see them in the party I just added.
The mutation's payload looks something like:
fragment on CreatePartyMutationPayload {
party
partyMembers - not sure what type this should be, an array of ids?
}
what getConfigs and/or payload structure would I need to tell Relay that every person in the partyMembers array needs to have their parties field in the cache invalidated?
Also, it may be that there are some server side rules where if I invite one person, their partner is also invited automatically. This means that I don't have a definitive list of the Person ids that will be invalidated in the client side mutation object until the payload comes back. How do I ensure that all the people in the party in the Payload are invalidated?