Skip to content

Commit

Permalink
Add optimistic response to starring contacts and tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Nov 9, 2022
1 parent 8930c7e commit b5153be
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ export const StarTaskIconButton: React.FC<Props> = ({
const toggleStarred = () => {
setTaskStarred({
variables: { accountListId, taskId, starred: !isStarred },
optimisticResponse: {
updateTask: {
__typename: 'TaskUpdateMutationPayload',
task: {
__typename: 'Task',
id: taskId,
starred: !isStarred,
},
},
},
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ export const StarContactIconButton: React.FC<Props> = ({
event.stopPropagation();
setContactStarred({
variables: { accountListId, contactId, starred: !isStarred },
optimisticResponse: {
updateContact: {
__typename: 'ContactUpdateMutationPayload',
contact: {
__typename: 'Contact',
id: contactId,
starred: !isStarred,
},
},
},
});
}}
>
Expand Down

0 comments on commit b5153be

Please sign in to comment.