Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public mutateOfflineElement(item: OfflineItem) {
const optimisticResponse = item.optimisticResponse;
const mutationName = getMutationName(item.query);
let context;
let updateFunction;
const previousContext: any = {};
context = { ...previousContext, ...this.getOfflineContext(item) };
if (this.mutationCacheUpdates && mutationName) {
updateFunction = this.mutationCacheUpdates[mutationName];
}
const mutationOptions: MutationOptions = {
variables: item.variables,
mutation: item.query,
// Restore optimistic response from operation in order to see it
optimisticResponse,
// Pass client update functions