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

Using Refetch with apollo to rerender query & component

I'm having issues rehydrating a component with new data via query. To set the premise i have two components that are siblings like this: ||
Karan
  • 1,141
  • 2
  • 19
  • 42
2
votes
2 answers

How to make Typescript recognize the type for an Apollo Query

I am trying to get Apollo to integrate with TypeScript. I have a React Class that looks like the following: interface Data { allVendors: Array; } class AllVendorsQuery extends Query {} const ShowVendors: React.SFC<> = props =>…
Mimo
  • 6,015
  • 6
  • 36
  • 46
2
votes
0 answers

Using implement in GraphQL without any arguments

If I want to use interface/implements without any arguments, how would I do that? My current code looks like this: interface User { GUID: String name: String age: Int } type FacebookUser implements User type GoogleUser implements…
user2687506
  • 789
  • 6
  • 21
2
votes
1 answer

Caching User after Authenticating with apollo

I'm quite new with react-apollo, however wasn't sure how to approach this problem. I'm authenticating a user with a mutation but would like to access that same user object, that's returned in other components again (live navbar, to render button…
Karan
  • 1,141
  • 2
  • 19
  • 42
2
votes
1 answer

How to use refetchQueries with reason-apollo?

I'm using reason-apollo and having problems trying to setup refetchQueries. My setup is very similar to the swapi example here. I have a listing and a form to add a new item via a mutation. After the mutation succeeds, I want to refetch the items in…
rk1
  • 988
  • 9
  • 13
2
votes
1 answer

Apollo mutation "In this environment the sources for assign MUST be an object"

Anyone know what to do with this kind of error during a mutation? Occurs here: const RepositoryItem = ({ repository, selectedRepositoryIds }: IProps) => { const isSelected = _.includes(selectedRepositoryIds, repository.id); return ( …
Thomas Hagström
  • 4,371
  • 1
  • 21
  • 27
2
votes
2 answers

Apollo Authentication with Gatsby

I am trying to implement the Authentication workflow officially described in the Apollo docs as I did before in other projects, but this time using Gatsby. The idea seems pretty straightforward. Need to create/update gatsby-browser.js like when…
Lionel T
  • 1,559
  • 1
  • 13
  • 30
2
votes
1 answer

Cross Component Communication Architecture with Apollo, Graphql

Often when building UI the Problem arises that User Input Components are located visually outside of components owning the state. Suppose you are building a wizard of forms with multiple steps, which has to submit a respective form on clicking the…
dre-hh
  • 7,840
  • 2
  • 33
  • 44
2
votes
1 answer

Defining JSON/Object type in graphql-tag

I'm kinda new to Apollo gql, just wondering if anyone know if its possible to define Object class in graphql-tag? export const CREATE_STYLE = gql` mutation styleCreate( $formID: String! $fontFamily: Object //how do you define…
Amy Lee
  • 277
  • 3
  • 15
2
votes
1 answer

GrahpQL: Create requests with multiple optional arguments

Using apollo-client and graphql-tag I'm trying to create a request something like: gql` { data( filter: ${options.filter} sort: ${options.sort} limit: ${options.limit} offset:…
joshhunt
  • 5,197
  • 4
  • 37
  • 60
2
votes
0 answers

how to fetch data from apollo-link-state every 2 seconds (client side data polling)

I'm trying to make a client side only notification (data not from the server) with react and apollo-link-state as a data store I'm asking how to fetch data from cache every 2 seconds (polling) ,the data is @client state data not from the server as…
2
votes
1 answer

Reuse mutations without duplicating code in Apollo + React?

I have the mutation below in a React Component. Im going to need the same mutation in multiple components and on different pages. How can I reuse my mutation code without repeating it? This example isn't that complex but some queries use…
Evanss
  • 23,390
  • 94
  • 282
  • 505
2
votes
1 answer

Mockin apollo-link-state queries

I've found some resources on how to mock regular queries with react-apollo. An example is the code below: import ApolloClient from 'apollo-client'; import { ApolloProvider } from 'react-apollo'; import { InMemoryCache } from…
jorgen
  • 3,425
  • 4
  • 31
  • 53
2
votes
1 answer

Send POST request to apollo server with "operationName" and "variables"

I follow this doc https://www.apollographql.com/docs/apollo-server/requests.html#postRequests and try to send a POST request to apollo server. test code: it('should get author correctly', () => { const body = { query: ` query { …
Lin Du
  • 88,126
  • 95
  • 281
  • 483
2
votes
1 answer

How to read response headers and write request headers using apollo-android

I'm trying to use apollo-android library to communicate with graphql server. The problem is that backend uses headers to authenticate requests and I found no ways to add them. Also in auth request the token is sent in headers and I found no ways to…
Vlad Kudoyar
  • 371
  • 3
  • 8