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
13
votes
2 answers

how to unsubscribe with useQuery and subscribeToMore

Another post shared an example of how to unsubscribe, where the Apollo docs don't. The Apollo docs do mention what subscribeToMore returns... subscribeToMore: A function that sets up a subscription. subscribeToMore returns a function that you can…
Chance Smith
  • 1,211
  • 1
  • 15
  • 32
13
votes
3 answers

How does one manually convert Apollo Android-generated objects into JSON strings and back?

I use the Apollo Android library to make queries to a GraphQL endpoint. Everything works OK until I try to convert the results back to JSON strings (to store them in a Room database). I naively tried to use Moshi, however this fails with the…
Giorgos Kylafas
  • 2,243
  • 25
  • 25
13
votes
4 answers

React Apollo GraphQL : Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag?

I keep getting this error when trying to update cache after mutation: Possible Unhandled Promise Rejection (id: 0): Invariant Violation: Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? The mutation…
Hugo
  • 2,073
  • 6
  • 23
  • 46
13
votes
1 answer

Differences between new HttpLink and createHttpLink from package apollo-link-http

In tutorial https://www.howtographql.com/vue-apollo/1-getting-started/ there is presented new HttpLink syntax, but in official docs https://www.apollographql.com/docs/link/links/http/ function createHttpLink is applied. None of these two sources…
Daniel
  • 7,684
  • 7
  • 52
  • 76
13
votes
1 answer

Are dynamic mocks possible in storybooks using Apollo's MockedProvider?

In my React storybooks, I want to be able to toy around with components that use graphQL queries and mutations (implemented with Apollo). This works fine using MockedProvider, as long as I specify in-advance the exact mutations, including their…
DoubleEwe
  • 151
  • 8
13
votes
1 answer

React Apollo Error: No more mocked responses for the query: mutation

Intended outcome: MockedProvider should mock my createPost mutation. Actual outcome: Error: No more mocked responses for the query: mutation... How to reproduce the issue: I have a very simple repository. I also created a separate branch with…
Michal
  • 4,952
  • 8
  • 30
  • 63
13
votes
2 answers

Apollo subscriptions - handling WS disconnects with subscribeToMore

I've been looking for a way to handle web socket disconnects in my React app with Apollo subscriptions and have not found a way to do so. The other examples I see in the apollo documentation show the below method for catching a reconnect: const…
red house 87
  • 1,837
  • 9
  • 50
  • 99
13
votes
2 answers

Querying NOT NULL GraphQL with Prisma

Schema: type TrackUser { id: ID! @unique createdAt: DateTime! user: User #note there is no `!` } type User { id: ID! @unique name: String! @unique } I want to get Alls TrackUser where User is not null. What would be the query?
Alan
  • 9,167
  • 4
  • 52
  • 70
13
votes
2 answers

How to fix `Warning: Text content did not match. Server: "Some Data" Client: "Loading..."`

I'm getting this error on initial load of my SSR application: Warning: Text content did not match. Server: "SOME DATA" Client: "Loading..." How to initialize client side of the app without setting loading flag to true? I’m setting up a SSR with…
rreckonerr
  • 387
  • 1
  • 3
  • 12
13
votes
2 answers

Apollo-client with parcel warnings

Have been trying to setup apollo-client with parcel for my react app. Things work fine but in the console, there are plenty of warnings regarding missing source files in node_modules/apollo-client in my CI pipeline. Have tried clearing yarn cache,…
Abhijeet_IXR
  • 807
  • 6
  • 15
13
votes
5 answers

Apollo-client returns "400 (Bad Request) Error" on sending mutation to server

I am currently using the vue-apollo package for Apollo client with VueJs stack with django and graphene-python for my GraphQl API. I have a simple setup with vue-apollo below: import Vue from 'vue' import { ApolloClient } from 'apollo-client' import…
Feyisayo Sonubi
  • 1,052
  • 5
  • 15
  • 27
13
votes
4 answers

refetchQueries in Mutation Component of React Apollo Client is not working?

I have a in my Home.js file Home.js {({ data: { product } }) => { return
deadcoder0904
  • 7,232
  • 12
  • 66
  • 163
13
votes
5 answers

How to use Apollo Client + React Router to implement private routes and redirection based on user status?

I am using React Router 4 for routing and Apollo Client for data fetching & caching. I need to implement a PrivateRoute and redirection solution based on the following criteria: The pages a user is permitted to see are based on their user status,…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
13
votes
1 answer

Apollo Server timeout while waiting for stream data

I'm attempting to wait for the result of a stream with my Apollo Server. My resolver looks like this. async currentSubs() { try { const stream = gateway.subscription.search(search => { …
ToraRTC
  • 440
  • 2
  • 4
  • 15
13
votes
1 answer

Best practices for refetching part of a GraphQL query with Apollo?

I have the following react-apollo-wrapped GraphQL query: user(id: 1) { name friends { id name } } As semantically represented, it fetches the user with ID 1, returns its name, and returns the id and name of all of its friends. I then…
Lucas
  • 16,930
  • 31
  • 110
  • 182