menu
Apollo

# Apollo Client

Let's talk Apollo Client.

Posts
Members
Search

Question / Unclear on refetchQueries

My fundimental question is do the variables for queries need to be exact for refetchQueries to work. Or can you give it a subset of variables and it will match similar queries. Consider the following .... and the following mutation: …

thumbsup
0
message-simple
3

What is the correct way to handle fetchMore errors?

Hi! I don't think i've found this in the docs. When I create an observable using and subscribe to this observable, I get the normal errors in the error callback. But when I invoke observable.fetchMore({ query, variables, updateQuery }), and the request fails, the error callback…

thumbsup
0
message-simple
1

Writing a mutation to replace an object in an array

I have the data laid out like this I'd like help writing the mutation that will bring the rest of the objects, but change a specific one with new data. I tried …

thumbsup
0
message-simple
1

Are Query and Mutation components good coding practice?​

I discovered Apollo when Query and Mutation components were already available, and so I started using them straight away. After I while I have noticed that my React components became messy with lots of mixed logic and render functions. Shouldn't it be better to use the classic…

thumbsup
1
message-simple
8

Improve `watchQuery` function

Hello, I am trying to separate as much as possible the logic from my UI components, and so I would like to replace all the Query components with my own code. To reproduce the Query component I make use of the watchQuery function, but I can see that it does not work as expected…

thumbsup
0
message-simple
0

Cookie no longer being passed in Headers after migrating from Apollo Boost

My app was previously using Apollo Boost and creating a new Apollo Client like this: I need to do file uploads in my app so needed to use apollo-upload-client which requires migration from Apollo Boost to the full Apollo Client so I updated the creation of my client to this with…

thumbsup
0
message-simple
1

Query not retriggered on re-render, UI not updating after authenticating

The problem that I have is that after a user logs in in my application, in the header component where I show the avatar (so user data) is not refreshed after login. This is how my login query looks like: The login returns a user. …

thumbsup
0
message-simple
0
Chase·3d

Docs wrong or me?

According to https://www.apollographql.com/docs/link/composition.html I can do import HttpLink from 'apollo-link-http';, but whenever I try, I get a terminal error of Attempted import error: 'apollo-link-http' does not contain a default export (imported as 'HttpLink').. Also,…

thumbsup
1
message-simple
3

Best practices for updating after mutations

There's many ways to update cache results after a mutation: 1. Returning the id + fields so that Apollo automagically knows how to update the cache 2. The update option in the Mutation tag …

thumbsup
1
message-simple
9

Apollo Client WS Error: "Invariant Violation: Must contain a query definition."

I'm trying to subscribe to a graphql query inside a NodeJS application using apollo-link-ws but I'm getting this error: Invariant Violation: Must contain a query definition.. Has anyone encountered this before? Here's my…

thumbsup
0
message-simple
5