How to use the relay-runtime.ConnectionHandler.insertEdgeAfter 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
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 morrys / offline-examples / relay / todo-updater / js / mutations / AddTodoMutation.js View on Github external
function sharedUpdater(store, user, newEdge) {
  // Get the current user record from the store
  const userProxy = store.get(user.id);

  // Get the user's Todo List using ConnectionHandler helper
  const conn = ConnectionHandler.getConnection(
    userProxy,
    'TodoList_todos', // This is the connection identifier, defined here
    // https://github.com/relayjs/relay-examples/blob/master/todo/js/components/TodoList.js#L76
  );

  // Insert the new todo into the Todo List connection
  ConnectionHandler.insertEdgeAfter(conn, newEdge);
}
github morrys / offline-examples / relay / react-native / todo-updater / src / mutations / AddTodoMutation.ts View on Github external
function sharedUpdater(store: any, user: any, newEdge: any) {
  // Get the current user record from the store
  const userProxy = store.get(user.id);

  // Get the user's Todo List using ConnectionHandler helper
  const conn = ConnectionHandler.getConnection(
    userProxy,
    "TodoList_todos" // This is the connection identifier, defined here
    // https://github.com/relayjs/relay-examples/blob/master/todo/js/components/TodoList.js#L76
  );

  // Insert the new todo into the Todo List connection
  ConnectionHandler.insertEdgeAfter(conn, newEdge);
}
github morrys / offline-examples / relay / nextjs / mutations / AddTodoMutation.ts View on Github external
function sharedUpdater(store: any, user: any, newEdge: any) {
  // Get the current user record from the store
  const userProxy = store.get(user.id);

  // Get the user's Todo List using ConnectionHandler helper
  const conn = ConnectionHandler.getConnection(
    userProxy,
    'TodoList_todos', // This is the connection identifier, defined here
    // https://github.com/relayjs/relay-examples/blob/master/todo/js/components/TodoList.js#L76
  );

  // Insert the new todo into the Todo List connection
  ConnectionHandler.insertEdgeAfter(conn, newEdge);
}
github coralproject / talk / src / core / client / stream / tabs / Comments / ReplyList / ReplyListViewNewMutation.tsx View on Github external
viewNewEdges.forEach(edge => {
        ConnectionHandler.insertEdgeAfter(connection, edge);
      });
      connection.setLinkedRecords([], "viewNewEdges");
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / private / components / settings / attributes / AttributeEdition.js View on Github external
const conn = ConnectionHandler.getConnection(
          userProxy,
          'Pagination_attributes',
          this.props.paginationOptions,
        );
        ConnectionHandler.deleteNode(conn, this.props.attribute.id);
        const payload = store
          .getRootField('attributeEdit')
          .getLinkedRecord('update', { input });
        const newEdge = ConnectionHandler.createEdge(
          store,
          conn,
          payload,
          'AttributeEdge',
        );
        ConnectionHandler.insertEdgeAfter(conn, newEdge);
        this.props.handleClose();
      },
      setSubmitting,
github taion / relay-todomvc / src / mutations / AddTodoMutation.js View on Github external
['any', 'active'].forEach(status => {
    const connection = ConnectionHandler.getConnection(
      userProxy,
      'TodoList_todos',
      { status },
    );
    if (connection) {
      ConnectionHandler.insertEdgeAfter(connection, todoEdge);
    }
  });
}