wallslide
03/24/2017, 9:25 AMnilan
03/24/2017, 9:32 AMwallslide
03/24/2017, 9:32 AMnilan
03/24/2017, 9:32 AMwallslide
03/24/2017, 9:33 AMwallslide
03/24/2017, 9:33 AMsubmitComment
creates a commentwallslide
03/24/2017, 9:33 AMupdateUser
to create a team and associate that team with a user, then two things are changing, and a relationship between those two things is also creatednilan
03/24/2017, 9:34 AMoptimisticResponse: {
__typename: 'Mutation',
submitComment: {
__typename: 'Comment',
postedBy: ownProps.currentUser,
createdAt: +new Date,
content: commentContent,
},
},
nilan
03/24/2017, 9:35 AMsubmitComment
with updateUser
, and then have a key team
and the value is a team objectwallslide
03/24/2017, 9:35 AMsubmitComment
would I just have an updateUser
, or would I also have a createTeam
in there?wallslide
03/24/2017, 9:35 AMupdateQueries
?nilan
03/24/2017, 9:36 AMoptimisticResponse: {
__typename: 'Mutation',
updateUser: {
__typename: 'User',
team: {
__typename: 'Team'
name: 'Some team'
},
},
},
nilan
03/24/2017, 9:36 AMnilan
03/24/2017, 9:37 AMupdateQueries
works differently, you need to include a key for every query that you want to updatewallslide
03/24/2017, 9:37 AMnilan
03/24/2017, 9:38 AMupdateQueries: {
// Would update the query that looks like:
// query myUserQuery { ... }
myUserQuery: (previousResult, { mutationResult }) => {
// ...
},
myTeamQuery: (previousResult, { mutationResult }) => {
// ...
},
}