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
9
votes
1 answer

Apollo MockedProvider always returns undefined for data field, even after loading

Some background: I've got a component that immediately calls a useQuery hook upon loading. While that query is running, I spin a loading spinner. Once it completes I render stuff based on the data. I've added a useEffect hook that watches the…
IanCZane
  • 600
  • 4
  • 21
9
votes
1 answer

Apollo Client - using cached results from object list in response to query for single object

Is it possible to configure the Apollo Client to fetch a single cached Item from a query that returns a list of Items, in order to prefetch data when querying for a single Item? Schema: type Item { id: ID! name: String! } type Query { items:…
cjpete
  • 491
  • 4
  • 9
9
votes
1 answer

Apollo Client return type in Typescript

I am trying to build a simple function inside a class that returns an Apollo Client. Here is my code: import appConfig from 'config/app-config'; import { ApolloClient, InMemoryCache, createHttpLink } from '@apollo/client'; import LocalStorageKeys…
davidaap
  • 1,569
  • 1
  • 18
  • 43
9
votes
2 answers

How do I generate the schema.graphql file when using Apollo Server?

When using Apollo Server to write a GraphQL server, how can I run a command on the server to generate the schema.graphql file for the client to consume? Note: I'm not using the Apollo Client, I'm using Relay. I know I can run the GraphQL playground…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
9
votes
2 answers

How to fix initialization error for DefaultKotlinSourceSetKt?

With project build (or simple Gradle sync), I have the following error: Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSetKt This error shows after change gradle…
9
votes
1 answer

What is the lifecycle of vue apollo subscriptions?

Does vue-apollo automatically unsubscribe the query when the View changes? For example, I have two views routed to /users and /orders. /users has a subscription to the users table and /orders has a subscription to the orders table. If I were on the…
zcaudate
  • 13,998
  • 7
  • 64
  • 124
9
votes
1 answer

Preventing: Store reset while query was in flight (not completed in link chain)

I get this randomly in my Apollo Client code. I'm using the anti-pattern of surrounding all setState with an isMounted flag to prevent attempts to set the state when a component is unmounted or a user is leaving a page. But I still get this Store…
notElonMusk
  • 314
  • 1
  • 4
  • 21
9
votes
2 answers

How to switch polling on and off in Apollo?

I use the useQuery Hook like this: function Foo() { const { data, error, loading } = useQuery(MY_QUERY, { pollInterval: 1000 }); return ( <> {data} ); } Now, both Bar and Baz use the same query.…
9
votes
3 answers

Apollo useQuery hook doesn't get update from cache with writeQuery() method. No errors seen

After using useMutation(), cache gets updated but useQuery() in Home component doesn't. I tried with a different fetchPolicy. I can see new posts in Apollo dev tool but the page needs to be updated to see the changes import { FETCH_POSTS_QUERY }…
Paul Sheldon
  • 93
  • 1
  • 4
9
votes
4 answers

Nestjs Apollo graphql upload scalar

I'm using nestjs graphql framework and I want to use apollo scalar upload I have been able to use the scalar in another project that did not include nestjs. schema.graphql App.module.ts register graphql GraphQLModule.forRoot({ typePaths:…
anthony willis muñoz
  • 2,346
  • 3
  • 16
  • 33
9
votes
1 answer

Polling and pagination at the same time with GraphQL Apollo?

To implement pagination with Apollo, you're typically going to use the fetchMore function, given to you when you send a query, in combination with updateQuery to tell Apollo how to update its cache with the result (appending it onto what you…
ostrebler
  • 940
  • 9
  • 32
9
votes
3 answers

Update ApolloClient headers after it was initialised

My app is wrapped with component that essentially initialises the client. const client = new ApolloClient({ link: new HttpLink({ // ... }), cache: new InMemoryCache({ // .. }), }); Further down the road users can make…
Ilja
  • 44,142
  • 92
  • 275
  • 498
9
votes
1 answer

How to fix error:only absolute URLS are supported in react ssr graphql

I'm setting the server side rendering with apollo for set up the graphql in server side but I dont now know how I ran into this problem when ever I tried to use the query in side the one component this error appear in cli: (node:4440)…
Sajjad Hadafi
  • 347
  • 1
  • 7
  • 18
9
votes
0 answers

Is it possible to access argument subfield in graphql query?

I'm looking for a way of accessing the subfield of query argument (object) without passing it as a separate argument. Here is the detailed case which explains why I need this. I have the following schema: type Query { users(input:…
9
votes
2 answers

React-Apollo Mutation returns empty response

I am using AWS Appsync where I want to get a response from a successfully executed mutation. When I try my setup in the Appsync Graphql console I get a filled "data": { "mutateMeeting" } response: When I try the same in my react application I can…
DrDirk
  • 1,937
  • 3
  • 25
  • 36