Updating the cache with data from the fragment

This commit is contained in:
okbel
2018-05-02 16:46:20 -03:00
parent c1492d1065
commit c7db780582
5 changed files with 33 additions and 12 deletions
@@ -46,7 +46,7 @@ ProfileContainer.propTypes = {
currentUser: PropTypes.object,
};
const slots = ['profileSections'];
const slots = ['profileSections', 'profileSettings', 'profileHeader'];
const withProfileQuery = withQuery(
gql`
@@ -336,6 +336,29 @@ export const withUpdateEmailAddress = withMutation(
variables: {
input,
},
update: proxy => {
const UpdateEmailAddressQuery = gql`
query Talk_UpdateEmailAddress {
me {
id
email
}
}
`;
const prev = proxy.readQuery({ query: UpdateEmailAddressQuery });
const data = update(prev, {
me: {
email: { $set: input.email },
},
});
proxy.writeQuery({
query: UpdateEmailAddressQuery,
data,
});
},
});
},
}),