reasonml-community / reason-apollo-hooks

Deprecated in favor of https://github.com/reasonml-community/graphql-ppx
https://reasonml-community.github.io/reason-apollo-hooks/
MIT License
137 stars 28 forks source link

Add fetch policy and cache update docs #35

Closed MargaretKrutikova closed 5 years ago

MargaretKrutikova commented 5 years ago

This PR adds fetchPolicy for useQuery, here is the source code for fetchPolicy option in apollo-client. I have also cleaned up the example with cache and removed some unnecessary raw JS and wrote some comments. I got a bit too carried away and wrote a bit of a too extensive explanation in the README, I can remove it if it is too much 😀

I felt like there are just too many caveats with updating apollo cache and other people are stumbling onto it too. The reasons are, first of all, that graphql response is parsed and there is no serialisation mechanism to transform the data back to the JS format (that have to be in cache), and second, the good ol' __typename that needs to be in cache but is not accessible in the reason code 🙃

fakenickels commented 5 years ago

Oh this is just amazing! Thanks @MargaretKrutikova will take a good look soon

MargaretKrutikova commented 5 years ago

Thank you! 😃

fakenickels commented 5 years ago

Thanks a lot again @MargaretKrutikova ! Will be releasing this soon

fakenickels commented 5 years ago

As you are contributing a lot @MargaretKrutikova I just added you as a collaborator to the repo!

MargaretKrutikova commented 5 years ago

Wow, thanks, that's really cool! 😃

fakenickels commented 5 years ago

Release under v2.6.0