Skip to content
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

Access Apollo client in update function => watched queries won't be updated #7

Open
eric-burel opened this issue Sep 21, 2020 · 0 comments
Labels
apollo bug Something isn't working need 3rd party fix

Comments

@eric-burel
Copy link
Collaborator

eric-burel commented Sep 21, 2020

In Vulcan, commit "3ac1a60b62fb78fd1d71d72f00b11172f34a0ed4" replaced cache by client in Apollo multi query updater.
For the record, this function updates list when you create a new item locally.
As a default, Apollo only provides you the cache. That's enough in most case, but updating the cache WON'T update watched queries. In this case, you have to call writeQuery on the client object and not just the cache

Our current implementation of Apollo client, and the method to access it, relies on @vulcan/next-apollo, which is a Next specific package (see #6), but we don't want @vulcan/react-hooks to depend on it.

The problem is that Apollo doesn't really provide a way to access the default Apollo client either, and does not include it in the update call parameter.
Technically, since you are in the mutation, there is such a client, it is just not exposed in the API.

To be fully solved, this issue must be solved at Apollo client level. Another solution is that the cache should actually trigger watched queries too?

Possibly related:

@eric-burel eric-burel added apollo bug Something isn't working need 3rd party fix labels Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo bug Something isn't working need 3rd party fix
Projects
None yet
Development

No branches or pull requests

1 participant