-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apollo2 withMessages #2089
Apollo2 withMessages #2089
Conversation
Awesome, having a sample implementation of local state will be a big help. Like in the other PR I would probably try to avoid using
I would say let's keep it verbose for now and avoid adding too many abstraction layers, and then once we have enough practice using it we can "vulcanize" it with an intermediary layer like we do with React Router. Using a simplified state management API like Rematch for apollo-link-state would be great, in fact that could/should be something that exists outside of Vulcan I guess?
We should ideally never use
Yes, I wanted to get the client part working first before worrying about SSR. |
Btw feel free to merge the PR yourself, let's focus on making things work for now and we can refine everything later. |
Okay then we can move the apollo client back into For documentation purposes regarding your question on the previous PR:
|
My only feedback is that Since those won't be used that frequently I think we can err on the side of being more verbose and explicit. |
Definitely, I will think about it. |
I updated the
withMessage
HOC to use the new Apollo Link State API instead of Redux. It can serve as an example too.Updating
react-apollo
to v2 seems to fix issues with undefined results in thegraphql
tag.The syntax with Apollo Link State is far more verbose than with Redux. It seems that the Apollo devs are waiting from more feedback from the community before they provide helpers. There are some redundancies between the gql queries and the mutations.
So I think it would be relevant to implement some helper functions, maybe smth similar to Redux or Rematch API, or even maybe to generate the mutations and defaults from a schema?
Goodbye GraphiQL/network tab: you can't debug State link with usual tools since queries are not on the network. Instead you have to use the Chrome Apollo tools (which are fine).
Also, I am not sure if moving the apolloClient folder to
client
is a good idea. The problem is that then you have to wrap a lot of code intoMeteor.isClient
. Yet it does not make sense to create an apollo-client on the server (eg defining an InMemory cache), how was this handled this in the first place with the v1?The default state is correctly set and retrieved, however I did not test the mutations yet.
I am trying to migrate an existing app to the new version. So far breaking changes are mostly related to RR4 (routes won't change for an obscure reason, and the API has changed, e.g currentRoute is not available anymore). The app seems ok with Apollo v2, since there are not much breaking changes. I guess SSR is also disabled?