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
15
votes
3 answers

Using multiple endpoints in Apollo Client

this is my first discussion post here. I have learned Apollo + GraphQL through Odyssey. Currently, I am building my own project using Next.js which required fetching data from 2 GraphQL endpoints. My problem: How can I fetch data from multiple…
Eugene
  • 163
  • 1
  • 1
  • 6
15
votes
2 answers

Apollo Client what are active queries?

My Setup Typescript React App Backend GraphQL API Apollo Client Inspecting with Apollo Client Devtools Extension My question What are active queries? The Apollo Docs talks about active queries a lot but I am struggling to get an actual…
Simon Verhoeven
  • 347
  • 4
  • 16
15
votes
0 answers

What is the difference between client.query and useQuery in Apollo?

In my query, I use a blend of remote and local properties. The local properties have different values depending on: The remote properties The current unix timestamp The local resolvers computes the local state according to these rules. Now, I face…
Paul Razvan Berg
  • 16,949
  • 9
  • 76
  • 114
15
votes
1 answer

Use Query Result as Argument in Next Level in GraphQL

Hullo everyone, This has been discussed a bit before, but it's one of those things where there is so much scattered discussion resulting in various proposed "hacks" that I'm having a hard time determining what I should do. I would like to use the…
calben
  • 1,328
  • 3
  • 18
  • 33
14
votes
1 answer

How to gracefully shut down (SIGTERM) an Apollo Server instance?

The actual HTTP server instance can be killed with server.close(callback), but I'm not sure what will happen with any pending WebSocket operations (mutations or queries being run through WebSockets). Since http.Server doesn't really know anything…
Fabis
  • 1,932
  • 2
  • 20
  • 37
14
votes
3 answers

Next js and Apollo - Cookie not being passed

I am using Next JS with Apollo and have set it up using the following config in my with-data HOC: import { ApolloClient } from 'apollo-client'; import { InMemoryCache } from 'apollo-cache-inmemory'; import { HttpLink } from…
red house 87
  • 1,837
  • 9
  • 50
  • 99
14
votes
1 answer

Django/Graphene/Apollo/django-webpack-loader/Vue: CORS/CSRF not working together?

I'm working on a project using Django as backend, Vue as frontend, and trying to implement Apollo/Graphene/GraphQL as data transfer layer. Most of it works, but I don't get my head around the CORS/CSRF settings. (Had really much research here. here,…
nerdoc
  • 1,044
  • 10
  • 28
14
votes
2 answers

How to know which fields were requested in a GraphQL query?

I have written a GraphQL query which like the one below: { posts { author { comments } comments } } I want to know how can I get the details about the requested child fields inside the posts resolver. I want to do it to avoid…
WitVault
  • 23,445
  • 19
  • 103
  • 133
14
votes
3 answers

apollo client:codegen typescript with @client query fields

Sorry if this is a bit involved, but I'm really trying to close the last mile on being able to use Apollo Client for local as well as server state, with automatic Typescript everywhere. To wit, I have a query like this: query…
Gavin
  • 6,495
  • 3
  • 21
  • 22
14
votes
5 answers

using apollo, cookie in response header but not being set

I'm developing a user login/register feature as part of a larger project and am working on localhost (apollo server and react apollo front-end). I'm using express-session for my sessions. When submitting my login I can see the response header has…
Michael Ross
  • 139
  • 1
  • 4
14
votes
2 answers

How can i run one mutation multiple times with different arguments in one request?

I have a mutation: const createSomethingMutation = gql` mutation($data: SomethingCreateInput!) { createSomething(data: $data) { something { id name } } } `; How do I create many Somethings in one request? Do…
Maxim Zubarev
  • 2,403
  • 2
  • 29
  • 48
14
votes
1 answer

Apollo - update() method getting called twice, both times with optimistic/fake data

I'm completely stuck on an Apollo problem, for which I've opened a GitHub issue and had zero response on. I'm calling an Apollo mutation, using optimisticResponse. The way it's supposed to work, as I understand it, is that update() gets called…
ffxsam
  • 26,428
  • 32
  • 94
  • 144
14
votes
1 answer

How to set a timeout on a request with Apollo-Client

I have a React-Native app where I make requests to a GraphQL server. Everything works fine except I need a way to set the timeout on the request/client to 5 or 10 seconds. Currently the request takes a very long time before it times out (around 1…
menderleit
  • 141
  • 1
  • 1
  • 4
13
votes
1 answer

GraphQL playground - sending Cookie as Http Header "disappears"

I'm testing some implementations in the GraphQL Playground, in which I want to send a specific cookie, so that I can fetch it in my resolver. I'm using the built in Http Headers pane in the playground: However, when I add headers named either…
Zeliax
  • 4,987
  • 10
  • 51
  • 79
13
votes
3 answers

How to tell GraphQL requests apart in dev tools network tab when all have identical URL?

How to tell GraphQL requests apart in dev tools network tab when all have identical URL? All my requests target /api/graphql so to tell them apart I need to click each one, switch to the "Headers" tab, scroll down to the "Request Payload" section…
molsson
  • 1,227
  • 11
  • 19