feat: add app connections w/ testing and deleting functions
This commit is contained in:
@@ -4,6 +4,31 @@ const cache = new InMemoryCache({
|
||||
typePolicies: {
|
||||
App: {
|
||||
keyFields: ['key']
|
||||
},
|
||||
Mutation: {
|
||||
mutationType: true,
|
||||
fields: {
|
||||
createConnection: {
|
||||
merge(existing, newConnection, { args, readField, cache }) {
|
||||
const appKey = readField('key', newConnection);
|
||||
const appCacheId = cache.identify({
|
||||
__typename: 'App',
|
||||
key: appKey,
|
||||
});
|
||||
|
||||
cache.modify({
|
||||
id: appCacheId,
|
||||
fields: {
|
||||
connections: (existingConnections) => {
|
||||
return [...existingConnections, newConnection];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return newConnection;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user