Update cache code

This commit is contained in:
Ramon Wenger 2022-01-28 23:22:28 +01:00
parent a3c616d10e
commit 656b2be364
2 changed files with 18 additions and 17 deletions

View File

@ -58,22 +58,22 @@ const typePolicies = {
objectiveGroup: {read: idToRefFactory('ObjectiveGroupNode')}, objectiveGroup: {read: idToRefFactory('ObjectiveGroupNode')},
projectEntry: {read: idToRefFactory('ProjectEntryNode')}, projectEntry: {read: idToRefFactory('ProjectEntryNode')},
// project: {read: idToRefFactory('ProjectNode')}, // project: {read: idToRefFactory('ProjectNode')},
// project: { project: {
// read(_, {args: {slug, id}, toReference}) { read(_, {args: {slug, id}, toReference}) {
// console.log(`Trying to reference project with slug ${slug}, id ${id}`); console.log(`Trying to reference project with slug ${slug}, id ${id}`);
// if (slug) { if (slug) {
// return toReference({ return toReference({
// __typename: 'ProjectNode', __typename: 'ProjectNode',
// slug id: slug
// }); });
// } else { } else {
// return toReference({ return toReference({
// __typename: 'ProjectNode', __typename: 'ProjectNode',
// id id
// }); });
// } }
// } }
// }, },
} }
}, },
}; };

View File

@ -14,12 +14,13 @@ export default {
variables: { variables: {
input, input,
}, },
update(store, {data: {updateProjectSharedState: {shared: final, errors}}}) { update: (store, {data: {updateProjectSharedState: {shared: final, errors}}}) => {
if (!errors) { if (!errors) {
const query = PROJECT_QUERY; const query = PROJECT_QUERY;
const variables = { const variables = {
id: id, id: id,
}; };
const {project} = store.readQuery({query, variables}); const {project} = store.readQuery({query, variables});
this.$log.debug(`updating project ${project.id} ${project.title}`); this.$log.debug(`updating project ${project.id} ${project.title}`);