-
Notifications
You must be signed in to change notification settings - Fork 28
Feat/optimistic response #69
Feat/optimistic response #69
Conversation
type t = { | ||
. | ||
"__typename": string, | ||
"updatePerson": { | ||
. | ||
"__typename": string, | ||
"age": int, | ||
"id": string, | ||
"name": string, | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it it's is now, this should be compatible with all versions of bucklescript, but can be changed to only work with bucklescript >= 7 if that's preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright!
@@ -11,6 +11,34 @@ module EditPersonMutation = [%graphql | |||
|} | |||
]; | |||
|
|||
module OptimisticResponse = { | |||
type t = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment that this is necessary because the types graphql_ppx_re generates are not 1:1 to the JS representation and probably this won't be necessary as soon as teamwalnut/graphql-ppx#20 gets merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have time to check back in before now. Would you still like me to add it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be appreciated! I haven't published yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it.
looks good to me! after that comment we're good to merge |
Released under v4.1.0 |
This adds optimistic response to
ApolloHooksMutation
and updates the Persons example to show how to correctly construct an optimistic response that apollo can understand.