I have a working mutation call in my Angular application for mutating some fields for an object with Apollo GraphQL. Part of the mutation call includes some return data that Apollo will associate with some object already in its cache and update it with the new value returned.
I would like to only return fields that are actually being mutated to avoid big packets being sent across the network.
I've managed to dynamically generate a mutation document that only includes fields being mutated and I'm passing that into apollo.mutate({mutation: newMutation, ...})
which returns an observable. The mutation only fires once that observable is subscribed to. I've verified that the component using that subscription is unsubscribing and being destroyed before the new mutation is called.
The problem is that Apollo is caching the mutation document and sending out the first mutation (with only fields mutated the first time) for all calls. I've verified this by checking my web browser's Network tab.
I've tried getting Apollo to stop caching it by using unique mutation names by appending datetime. I've checked that variables to the mutation are unique. I've tried using fragments, yet the fragments would also need to be dynamically generated and it's the same issue.
Anyone know what I'm doing wrong?