Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'));
}
}
store => {
// $FlowFixMe (T62907961) Relay flow types
const rootQuery = store.getRoot();
const locationTypes = ConnectionHandler.getConnection(
rootQuery,
'Catalog_locationTypes',
);
ConnectionHandler.deleteNode(
// $FlowFixMe (T62907961) Relay flow types
locationTypes,
this.props.locationType.id,
);
// $FlowFixMe (T62907961) Relay flow types
store.delete(this.props.locationType.id);
},
);
store => {
// $FlowFixMe (T62907961) Relay flow types
const rootQuery = store.getRoot();
const serviceTypes = ConnectionHandler.getConnection(
rootQuery,
'ServiceTypes_serviceTypes',
);
ConnectionHandler.deleteNode(
// $FlowFixMe (T62907961) Relay flow types
serviceTypes,
this.props.serviceType.id,
);
// $FlowFixMe (T62907961) Relay flow types
store.delete(this.props.serviceType.id);
},
);
delete: id => {
const root = store.getRoot()
const connection = ConnectionHandler.getConnection(root, name, args)
ConnectionHandler.deleteNode(connection, id)
},
add: (edgeType, id) => {
deletedIDs.forEach(deletedID =>
ConnectionHandler.deleteNode(conn!, deletedID),
)
updater: (store) => {
const container = store.getRoot();
const payload = store.getRootField('tagEdit');
const userProxy = store.get(container.getDataID());
const conn = ConnectionHandler.getConnection(
userProxy,
'Pagination_tags',
this.props.paginationOptions,
);
ConnectionHandler.deleteNode(conn, payload.getValue('delete'));
},
onCompleted: () => {
connections.forEach(con =>
ConnectionHandler.deleteNode(con, input.commentID)
);
store => {
const rootQuery = store.getRoot();
const workOrderTypes = ConnectionHandler.getConnection(
rootQuery,
'Configure_workOrderTypes',
);
ConnectionHandler.deleteNode(
workOrderTypes,
this.props.workOrderType.id,
);
store.delete(this.props.workOrderType.id);
},
);
['any', 'active', 'completed'].forEach((status) => {
const connection = ConnectionHandler.getConnection(
userProxy, 'TodoList_todos', { status },
);
if (connection) {
ConnectionHandler.deleteNode(connection, deletedId);
}
});
}