How to use the react-relay/classic.Mutation function in react-relay

To help you get started, weโ€™ve selected a few react-relay 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 meedan / check-web / src / app / relay / mutations / UpdateContactMutation.js View on Github external
import Relay from 'react-relay/classic';

class UpdateContactMutation extends Relay.Mutation {
  getMutation() {
    return Relay.QL`mutation updateContact {
      updateContact
    }`;
  }

  static fragments = {
    contact: () => Relay.QL`fragment on Contact { id,location,web,phone }`,
  };

  getVariables() {
    return {
      id: this.props.id,
      location: this.props.location,
      web: this.props.web,
      phone: this.props.phone,
github meedan / check-web / src / app / relay / mutations / CreateTagMutation.js View on Github external
import Relay from 'react-relay/classic';

class CreateTagMutation extends Relay.Mutation {
  getMutation() {
    return Relay.QL`mutation createTag {
      createTag
    }`;
  }

  getFatQuery() {
    switch (this.props.parent_type) {
    case 'source':
      return Relay.QL`fragment on CreateTagPayload { tagEdge, source { log, tags, log_count } }`;
    case 'project_media':
      return Relay.QL`fragment on CreateTagPayload { tagEdge, project_media { last_status, last_status_obj,log, tags, log_count, project_id } }`;
    case 'project_source':
      return Relay.QL`fragment on CreateTagPayload { tagEdge, project_source { source { log, tags, log_count } } }`;
    default:
      return '';
github buildkite / frontend / app / mutations / TeamPipelineUpdate.js View on Github external
import Relay from 'react-relay/classic';

class TeamPipelineUpdate extends Relay.Mutation {
  static fragments = {
    teamPipeline: () => Relay.QL`
      fragment on TeamPipeline {
        id
      }
    `
  }

  getMutation() {
    return Relay.QL`
      mutation {
        teamPipelineUpdate
      }
    `;
  }
github meedan / check-web / src / app / relay / mutations / CreateFlagMutation.js View on Github external
import Relay from 'react-relay/classic';

class CreateFlagMutation extends Relay.Mutation {
  getMutation() {
    return Relay.QL`mutation createFlag {
      createFlag
    }`;
  }

  getFatQuery() {
    switch (this.props.parent_type) {
    case 'source':
      return Relay.QL`fragment on CreateFlagPayload { flagEdge, source { log, log_count } }`;
    case 'project_media':
      return Relay.QL`fragment on CreateFlagPayload { flagEdge, project_media { last_status, last_status_obj, log, log_count } }`;
    default:
      return '';
    }
  }
github meedan / check-web / src / app / relay / mutations / UpdateProjectMediaMutation.js View on Github external
import Relay from 'react-relay/classic';
import optimisticProjectMedia from './optimisticProjectMedia';

class UpdateProjectMediaMutation extends Relay.Mutation {
  getMutation() {
    return Relay.QL`mutation updateProjectMedia {
      updateProjectMedia
    }`;
  }

  getFatQuery() {
    if (this.props.metadata) {
      return Relay.QL`
        fragment on UpdateProjectMediaPayload {
          project_media {
            id,
            overridden,
            metadata,
          }
        }
github firstlookmedia / react-scripts / scripts / utils / __mocks__ / react-relay / classic.js View on Github external
}
    this.reset();
  }

  commitUpdate(mutation, callbacks) {
    return this.update(callbacks);
  }

  applyUpdate(mutation, callbacks) {
    return this.update(callbacks);
  }
}

module.exports = {
  QL: Relay.QL,
  Mutation: Relay.Mutation,
  Route: Relay.Route,
  RootContainer: ({ renderFetched }) => renderFetched({}),
  createContainer: component => component,
  Store: new MockStore(),
};
github meedan / check-web / src / app / relay / mutations / DeleteTeamBotInstallationMutation.js View on Github external
import Relay from 'react-relay/classic';

class DeleteTeamBotInstallationMutation extends Relay.Mutation {
  getMutation() {
    return Relay.QL`mutation destroyTeamBotInstallation {
      destroyTeamBotInstallation
    }`;
  }

  getVariables() {
    return { id: this.props.id };
  }

  getFatQuery() {
    return Relay.QL`fragment on DestroyTeamBotInstallationPayload {
      deletedId
      team { id }
      team_bot: bot_user {
        id
github buildkite / frontend / app / mutations / PipelineScheduleCreate.js View on Github external
import Relay from 'react-relay/classic';

class PipelineScheduleCreate extends Relay.Mutation {
  static fragments = {
    pipeline: () => Relay.QL`
      fragment on Pipeline {
        id
      }
    `
  }

  getMutation() {
    return Relay.QL`
      mutation {
        pipelineScheduleCreate
      }
    `;
  }
github buildkite / frontend / app / mutations / OrganizationMemberUpdate.js View on Github external
import Relay from 'react-relay/classic';

export default class OrganizationMemberUpdate extends Relay.Mutation {
  static fragments = {
    organizationMember: () => Relay.QL`
      fragment on OrganizationMember {
        id
      }
    `
  }

  getMutation() {
    return Relay.QL`
      mutation {
        organizationMemberUpdate
      }
    `;
  }
github meedan / check-web / src / app / relay / mutations / CreateMemebusterMutation.js View on Github external
import Relay from 'react-relay/classic';

class CreateMemebusterMutation extends Relay.Mutation {
  getMutation() {
    return Relay.QL`mutation {
      createDynamicAnnotationMemebuster
    }`;
  }

  getFatQuery() {
    return Relay.QL`fragment on CreateDynamicAnnotationMemebusterPayload {
      dynamicEdge,
      project_media {
        annotations(first: 1, annotation_type: "memebuster")
      }
    }`;
  }

  getFiles() {