Closed jfrolich closed 4 years ago
Thanks for your proposal! I think we can leave this opened for a while to see what others will say about it
Sounds great. I am pretty new to Reason/OCaml, so there are probably many things that can be better.
No opinions of otherss so far but in overall I liked the simplification. Can you update the examples? After that I think we are good to go
I updated the PR, a few changes:
graphql_ppx
in the example to graphql_ppx_re
(which is a maintained version of graphql_ppx
in reason -- same API).ApolloHooks.useQuery
directly instead of ApolloHooks.Query.useQuery
or something. Also have all the hooks available when opening ApolloHooks
.Thanks a lot @jfrolich ! These next upcoming weeks we'll be really busy for me but I'll try to review and merge ASAP
Thanks a lot @jfrolich ! These next upcoming weeks we'll be really busy for me but I'll try to review and merge ASAP
Cool. No worries. When this is merged I also have a pull-request that allows to do fetchMore
in pure reason, instead of the raw bucklescript escape hatch!
This looks fantastic!
We've added code-gen support for the current API, you can see the current usage for both queries and mutations here: https://serve.onegraph.com/short/B8DR68 (open code exporter and choose Reason
as the language)
I'd love to get this merged in and make the code that much more approachable for workshops (and for me too of course!).
Amazing!! Will get this merged before weekend 🙏
This looks fantastic!
We've added code-gen support for the current API, you can see the current usage for both queries and mutations here: https://serve.onegraph.com/short/B8DR68 (open code exporter and choose
Reason
as the language)I'd love to get this merged in and make the code that much more approachable for workshops (and for me too of course!).
Wow that codegen is awesome!
Amazing!! Will get this merged before weekend 🙏
I merged in the upstream changes and upgraded graphql_ppx_re
in the example.
Merged will release soon!
Thanks lot @jfrolich for this!! Awesome work. And thanks everyone for giving feedback
I am a bit late to the party, but what happened to errorPolicy
in useQuery
? I think it disappeared.
Looks like we have some regressions here indeed, along with #57
We haven't released this just yet so there is still time to fix
I will try to run the example project locally, and see what I can fix 😄
I think will be better to revert this and open the PR again so we can make we have less breaking changes
@jfrolich would you mind reopening this PR?
Sorry about this. I could directly merge master because due to filename changes it wouldn't diff the fires. So I looked up the individual commits and applied them manually, but I messed up and missed two additions!
I will re-open this PR, and fix the issues as reported.
Some comments of @MargaretKrutikova are about existing code not related to this PR. This can be tackled in a separate PR. (Except the naming of incompleteMutation
, happy to change this name if anyone has a name that is better suited or a way so we don't need to pass in the incomplete mutation.
@all-contributors add @jfrolich code, review and ideas
@fakenickels
I've put up a pull request to add @jfrolich! :tada:
This is a WIP, but I found that the functor API created quite a bit of boilerplate code. When I looked at the source of reason-urql, it found a way to implement a more concise API, so I messed around with the source of reason-react-hooks if we can have something like that that with apollo and this is the result. I would like to get your opinion and possible improvements.
In short we can go from this:
to this:
Similar for mutations, however we need to pass in an initial mutation if we want to provide variables later:
We can run the create function like this:
or we can add the mutation from the get go (and then we don't have to supply it later):
To be honest the mutation API is suboptimal. I think there is a way that we do not need to provide the
incompleteMutation
but this involves changing the javascriptuseMutation
hook. OR we need to modifygraphql_ppx
, to generate a different module.