Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
}
}
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);
}
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);
}
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);
}
viewNewEdges.forEach(edge => {
ConnectionHandler.insertEdgeAfter(connection, edge);
});
connection.setLinkedRecords([], "viewNewEdges");
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,
['any', 'active'].forEach(status => {
const connection = ConnectionHandler.getConnection(
userProxy,
'TodoList_todos',
{ status },
);
if (connection) {
ConnectionHandler.insertEdgeAfter(connection, todoEdge);
}
});
}