Questions tagged [apollo-client]

Apollo Client is a JavaScript library for building client UIs that fetch data using GraphQL.

Apollo Client is the best way to use GraphQL to build client applications. The client is designed to help you quickly build a UI that fetches data with GraphQL, and can be used with any JavaScript front-end.

Apollo Client

Repository

3353 questions
1
vote
0 answers

Apollo readFragment and dataIdFromObject

I've configured ApolloClient like this: import { ApolloClient, InMemoryCache } from '@apollo/client'; export const apolloClient = new ApolloClient({ uri: 'http://localhost:4000', cache: new InMemoryCache({ dataIdFromObject: obj =>…
mpen
  • 272,448
  • 266
  • 850
  • 1,236
1
vote
1 answer

Gatsby Link Resets Apollo Client

I am trying to implement Gatsby with Apollo Client Here is my gatsby-browser.js file export const wrapPageElement = ({ element, props }) => { const client = new ApolloClient({ uri: "http://localhost:3000/graphql", cache: new…
1
vote
1 answer

Apollo - Updating cache when some fields in some results are missing

For the following query, in some objects in the results array, some of the requested fields might not be present in the response (for example photo or address), which causes the data of my useQuery to be undefined (without any error or…
Zaff
  • 137
  • 3
  • 15
1
vote
0 answers

GraphQL - Apollo Client 3 | Pagination

I'm new to Apollo Client and I'm trying to wrap my head around field policies to implement pagination. So basically I have a category page where I perform a query that is based on the the slug that I receive from the URL of the page, returns a list…
Zakaria
  • 421
  • 5
  • 13
1
vote
0 answers

Unable to pass enum value to mutation

I have the following schema definition: enum CommunityType { INTEREST COMPANY INDUSTRY } ... extend type Mutation { createCommunity(name: String!, type: CommunityType): Community } And the following mutation: mutation CreateCommunity($name:…
mitchkman
  • 6,201
  • 8
  • 39
  • 67
1
vote
1 answer

How do I run GraphQL queries after router.query?

Started learning React and Next just some time ago and having trouble making this work. Also tried using useLazyQuery but could not figure out how to return properly. ... const TaskSingle = () => { const { category } = router.query; const…
emirowski
  • 265
  • 3
  • 13
1
vote
0 answers

Error: The keyPrefix reduxPersist: is already in use. Multiple clients cannot share the same keyPrefix

When I am upgrading expo from sdk-33 to sdk-40 version of expo. I am getting this issue, I have aws_appsync dependency in my react-native version 59.10.0. The problem is occurring when I create new AWSAppSyncClient, I have set "disableOffline"…
1
vote
1 answer

How to correctly type an Apollo Client instance in Flow?

I'm unsure what the correct type of a new ApolloClient is and I can't use any. Would it be best to create an interface for the ApolloClient instance? If so, what would the interface look like since there are so many different options? This is what…
Noob
  • 754
  • 3
  • 10
  • 27
1
vote
0 answers

How can I properly call this custom hook, and avoid infinite re-renders?

I'm using Apollo Client and wanted to make re-usable calls, so I was recommended to use Custom Hooks. I've tried but don't think I'm implementing them properly as they're re-rendering indefinitely and I can't figure out if this will actually do what…
Thingamajig
  • 4,107
  • 7
  • 33
  • 61
1
vote
1 answer

Nuxt / Apollo - Set Authorization Header

I am trying to create a login functionality using nuxtjs with the nuxtjs apollo-module and nodejs in the backend using apollo-server. I would like to pass the token from the frontend (nuxtjs/apollo-client) to the backend…
Schwesi
  • 4,753
  • 8
  • 37
  • 62
1
vote
0 answers

Why I am getting 'ApolloParseException' after upgrading from 1.0.0-alpha to 1.0.0?

I am currently upgraded an old project's Apollo version from 1.0.0-alpha to 1.0.0 . After upgrading I am getting this Exception com.apollographql.apollo.exception.ApolloParseException: Failed to parse http response at…
RagAnt
  • 1,064
  • 2
  • 17
  • 35
1
vote
0 answers

update to cache on apollo graphql

I have a list of contacts where I can add a new contact. As soon a new contact is added, I need to show it on the list of contacts without using refetchQueries. I tried to do this watching on the apollo documentation addContact( data:…
Serenity
  • 3,884
  • 6
  • 44
  • 87
1
vote
0 answers

Apollo removes nested object

I have a nested object to return. The first screen is the network response, the second one is the actual JS object from Apollo: The query is simple: query{ order(_id:"5fe71dd045491e1cf0d2b58c"){ _id orderId manager{ _id …
Simon Pasku
  • 539
  • 2
  • 4
  • 17
1
vote
0 answers

Apollo Android GraphQL client - Duplicate code generation for same responses

I'm currently using Apollo's Android GraphQL client to interact with our GraphQL server. I have several queries and mutations defined in my graphql file. A couple of them return same data structure in the response. However, the code that's…
Ugurcan Yildirim
  • 5,973
  • 3
  • 42
  • 73
1
vote
0 answers

You are calling concat on a terminating link, which will have no effect in apollo

I have code: import { ApolloClient, ApolloLink, InMemoryCache, from, HttpLink } from '@apollo/client'; import { WebSocketLink } from '@apollo/client/link/ws'; import { SubscriptionClient } from 'subscriptions-transport-ws'; import { HOST,…
yihereg819
  • 131
  • 1
  • 6