Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
}
}
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'));
}
}
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: () => {
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
const userProxy = store.get(userId);
const conn = ConnectionHandler.getConnection(
userProxy,
'Pagination_malwares',
paginationOptions,
);
ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
const userProxy = store.get(userId);
const conn = ConnectionHandler.getConnection(
userProxy,
'Pagination_coursesOfAction',
paginationOptions,
);
ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
const userProxy = store.get(userId);
const conn = ConnectionHandler.getConnection(
userProxy,
'Pagination_attributes',
paginationOptions,
);
ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
const userProxy = store.get(userId);
const conn = ConnectionHandler.getConnection(
userProxy,
'Pagination_workspaces',
paginationOptions,
);
ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
const userProxy = store.get(userId);
const conn = ConnectionHandler.getConnection(
userProxy,
'Pagination_campaigns',
paginationOptions,
);
ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
const sharedUpdater = (store, userId, paginationOptions, newEdge) => {
const userProxy = store.get(userId);
const conn = ConnectionHandler.getConnection(
userProxy,
'Pagination_threatActors',
paginationOptions,
);
ConnectionHandler.insertEdgeBefore(conn, newEdge);
};
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: () => {