Questions tagged [apollo]

Apollo is a GraphQL client and cache for JavaScript, iOS (Swift) and Android.

Apollo is a flexible, fully-featured client for every platform.

Apollo is made up of a family of technologies you can incrementally add to your stack: Apollo Client to connect data to your UI, Apollo Engine for infrastructure and tooling, and Apollo Server to translate your REST API and backends into a GraphQL schema.

It has implementations for JavaScript, iOS and Android. The JavaScript client has integrations for React, Angular, Vue.js, Ember.js and more.

Apollo is fully compatible with any server that implements the GraphQL specification.

4536 questions
12
votes
4 answers

Angular - Apollo: Client has not been defined yet

I'm using apollo client for graphql. I set up the client in AppApolloModule that I'm importing in AppModule. I'm making a query in a service which is also imported right in the AppModule. Although the service runs before the AppApolloModule runs and…
Manzur Khan
  • 2,366
  • 4
  • 23
  • 44
12
votes
1 answer

How to deal with nested state in apollo-link-state (similar to Redux's combineReducers)

If we look at the todos example, imagine that the application had multiple views (a TodoList page and another page). So instead of "todos" directly referring to an array of todo items, at the top level of the state/store/cache it would actually…
Soren
  • 307
  • 1
  • 2
  • 11
12
votes
1 answer

Why do GraphQL fragments need __typename in queries?

I can't find or I am looking in the wrong place for any documentation on how fragments are matched. When I use the vanilla Apollo client if I turn off the option of addTypename when I use fragments I get a warning heuristic fragment matching going…
Barry
  • 1,800
  • 2
  • 25
  • 46
12
votes
2 answers

Context vs RootValue in Apollo GraphQL

In graphQLOptions, what is the difference between context and rootvalue? When should I use one, and when should I use the other? At the moment I'm attaching connectors and other sensitive data to the context, is this safe? Can the user read the…
Mascarpone
  • 2,516
  • 4
  • 25
  • 46
12
votes
2 answers

Global Loading Flag for Apollo Client

Is there a global loading flag available anywhere for react-apollo client? I have a “page wrapper” component that i’d like to apply ui effects to after all the child components have received their data. I have set up apollo with redux so have ready…
elmpp
  • 550
  • 1
  • 7
  • 16
11
votes
3 answers

Why does useQuery call cause a re-render in my component?

As we know a react component is re-rendered when it's props or state changes. Now i'm using useQuery from react-apollo package like below: import { gql, useQuery } from '@apollo/client'; const getBookQuery = gql` { books { name } …
D_S_X
  • 1,351
  • 5
  • 17
  • 35
11
votes
2 answers

Apollo client issues in next.js , javascript, graphql, react js

If I visit home page at first or refresh the home page, I can't get profile in resolver because cache.readQuery is not working. As well as it calls the api infinitely. If I move to another page and comeback to home page again, cache.readQuery works…
i-Guru
  • 164
  • 4
  • 25
11
votes
1 answer

Why Express (or other integration) with Apollo GraphQL Sever?

I am struggling to understand the added value of Express (or Koa, Hapi, etc) integration with Apollo GraphQL server. I see it can work in stand alone mode very well (an example:…
Aleks
  • 5,674
  • 1
  • 28
  • 54
11
votes
1 answer

Duplicate object types in Apollo GraphQL for Android

On my project GraphQL schema the object AllowedPeriod (it's just two fields startsAt/endsAt) can arrive inside different objects of the graph. When generating queries, apollo is creating a new type for every .AllowedPeriod For…
Budius
  • 39,391
  • 16
  • 102
  • 144
11
votes
1 answer

apollo "Subscription field must return Async Iterable. Received: undefined"

I have a mutation that fires the channel event 'countIncr', but I don't see the active corresponding subscription fire with the event payload. UPDATE: I've made several updates to this posting and now I'm changing the title to be more representative…
Falieson
  • 2,198
  • 3
  • 24
  • 35
11
votes
0 answers

withNavigation can only be used on a view hierarchy - Error when using FluidNavigation instead createStackNavigation

I got this issue today morning when I was trying to implement a Fluid Navigation between scenes using react-native-fluid-transitions. After I replace createStackNavigator for createFluidNavigator or FluidNavigator I got the screen issue…
Nicollas
  • 250
  • 2
  • 9
11
votes
2 answers

Invariant Violation: Unable to find node on an unmounted component. Apollo

I have some problems testing a Component inside a Create React App that returns a Query Component, I'm using jest and enzyme for testing. The error that I get is Invariant Violation: Unable to find node on an unmounted component.. Any ideas with…
Cristian Florea
  • 123
  • 1
  • 7
11
votes
2 answers

Why use IntrospectionFragmentMatcher?

Is there any reason to use IntrospectionFragmentMatcher to determine concrete types of values returned from interface and union fields? I'm talking about apollo-client. I'm using InMemoryCache with addTypename: true, so the type is known the moment…
kdojeteri
  • 755
  • 6
  • 17
11
votes
2 answers

apollo-link-state cache.writedata results in Missing field warning

When I call a mutation on my client I get the following warning: writeToStore.js:111 Missing field updateLocale in {} This is my stateLink: const stateLink = withClientState({ cache, resolvers: { Mutation: { updateLocale: (root, {…
Rob Indesteege
  • 548
  • 1
  • 8
  • 19
11
votes
5 answers

React Native Apollo error: "Network error: Network request failed"

On IOS, the application runs correctly. But on Android I get this error. Here's my config in client and server. Please help! Error: Error image Here's the config on client: import ApolloClient, { createNetworkInterface } from 'apollo-client'; import…
linhnh
  • 111
  • 1
  • 1
  • 6