How to use the relay-runtime.ConnectionHandler.getConnection function in relay-runtime

To help you get started, weโ€™ve selected a few relay-runtime 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 Bastiani / bastiani-blog / lib / mutationUtils.ts View on Github external
store,
  parentId,
  connectionName,
  edge,
  before = false,
}: IListRecord) {
  if (edge) {
    const parentProxy = store.get(parentId);
    if (!parentProxy) {
      // eslint-disable-next-line
      return console.warn(
        `The parentId (${parentId}), is not found in store, probably this is not a global field ID`,
      );
    }

    const conn = ConnectionHandler.getConnection(parentProxy, connectionName);
    // eslint-disable-next-line
    if (!conn) { return console.warn("The connection to update was not found."); }

    if (before) {
      ConnectionHandler.insertEdgeBefore(conn, edge);
    } else {
      ConnectionHandler.insertEdgeAfter(conn, edge);
    }
  }
}
github taion / relay-todomvc / src / mutations / ChangeTodoStatusMutation.js View on Github external
function sharedUpdater(store, user, todoProxy) {
  // In principle this could add to the active connection, but such an
  // interaction is not possible from the front end.
  const userProxy = store.get(user.id);
  const status = todoProxy.getValue('complete') ? 'active' : 'completed';
  const connection = ConnectionHandler.getConnection(
    userProxy, 'TodoList_todos', { status },
  );
  if (connection) {
    ConnectionHandler.deleteNode(connection, todoProxy.getValue('id'));
  }
}
github OpenCTI-Platform / opencti / opencti-front / src / private / components / person / PersonPopover.js View on Github external
updater: (store) => {
        const container = store.getRoot();
        const payload = store.getRootField('userEdit');
        const userProxy = store.get(container.getDataID());
        const conn = ConnectionHandler.getConnection(
          userProxy,
          'Pagination_users',
          this.props.paginationOptions,
        );
        ConnectionHandler.deleteNode(conn, payload.getValue('delete'));
      },
      onCompleted: () => {
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / private / components / threats / malwares / MalwareCreation.js View on Github external
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
  const userProxy = store.get(userId);
  const conn = ConnectionHandler.getConnection(
    userProxy,
    'Pagination_malwares',
    paginationOptions,
  );
  ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / private / components / techniques / courses_of_action / CourseOfActionCreation.js View on Github external
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
  const userProxy = store.get(userId);
  const conn = ConnectionHandler.getConnection(
    userProxy,
    'Pagination_coursesOfAction',
    paginationOptions,
  );
  ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / private / components / settings / attributes / AttributeCreation.js View on Github external
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
  const userProxy = store.get(userId);
  const conn = ConnectionHandler.getConnection(
    userProxy,
    'Pagination_attributes',
    paginationOptions,
  );
  ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / private / components / workspaces / WorkspaceCreation.js View on Github external
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
  const userProxy = store.get(userId);
  const conn = ConnectionHandler.getConnection(
    userProxy,
    'Pagination_workspaces',
    paginationOptions,
  );
  ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / private / components / threats / campaigns / CampaignCreation.js View on Github external
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
  const userProxy = store.get(userId);
  const conn = ConnectionHandler.getConnection(
    userProxy,
    'Pagination_campaigns',
    paginationOptions,
  );
  ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / private / components / threats / threat_actors / ThreatActorCreation.js View on Github external
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
  const userProxy = store.get(userId);
  const conn = ConnectionHandler.getConnection(
    userProxy,
    'Pagination_threatActors',
    paginationOptions,
  );
  ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
github OpenCTI-Platform / opencti / opencti-front / src / private / components / marking_definition / MarkingDefinitionPopover.js View on Github external
updater: (store) => {
        const container = store.getRoot();
        const payload = store.getRootField('markingDefinitionEdit');
        const userProxy = store.get(container.getDataID());
        const conn = ConnectionHandler.getConnection(
          userProxy,
          'Pagination_markingDefinitions',
          this.props.paginationOptions,
        );
        ConnectionHandler.deleteNode(conn, payload.getValue('delete'));
      },
      onCompleted: () => {