How to use the offix-cache.getMutationName function in offix-cache

To help you get started, we’ve selected a few offix-cache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aerogear / offix / packages / offix-offline / src / offline / OfflineMutationsHandler.ts View on Github external
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

offix-cache

GraphQL Mutation and Subscription Helpers

Apache-2.0
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages