Questions tagged [apollostack]

The Apollo GraphQL platform is an implementation of GraphQL that helps you manage data from the cloud to your UI.

Read more about the entire stack here: Apollo Platform

106 questions
66
votes
2 answers

Apollo GraphQL React - how to query on click?

In the Apollo React docs http://dev.apollodata.com/react/queries.html#basics there are examples of fetching automatically when the component is shown, but I'd like to run a query when a button is clicked. I see an example to "re"fetch a query when a…
atkayla
  • 6,193
  • 11
  • 53
  • 99
38
votes
7 answers

Does apollo-client work on node.js?

I need a graphql client lib to run on node.js for some testing and some data mashup - not in a production capacity. I'm using apollo everywhere else (react-apollo, apollo's graphql-server-express). My needs are pretty simple. Is apollo-client a…
Ed Staub
  • 14,730
  • 3
  • 55
  • 86
24
votes
6 answers

How to update the Redux store after Apollo GraphQL query returns

I'm fetching a list of data with the graphql HOC provided by react apollo. E.g.: const fetchList = graphql( dataListQuery, { options: ({ listId }) => ({ variables: { listId, }, }), props: ({ data: { loading,…
TheWebweiser
  • 571
  • 4
  • 10
22
votes
3 answers

How to create a nested resolver in apollo graphql server

Given the following apollo server graphql schema I wanted to break these down into separate modules so I don't want the author query under the root Query schema.. and want it separated. So i added another layer called authorQueries before adding it…
elbarto
  • 223
  • 1
  • 2
  • 7
21
votes
5 answers

GraphQL mutation that accepts an array of dynamic size and common scalar types in one request

I need to be able to create a user and add it's favourite movies (An array of objects with a reference to the Movies collection and his personal rating for each movie) in a single request. Something that could look like this (pseudocode) var…
octohedron
  • 3,868
  • 6
  • 42
  • 69
14
votes
2 answers

How to determine mutation loading state with react-apollo graphql

2018 Update: Apollo Client 2.1 added a new Mutation component that adds the loading property back. See @robin-wieruch's answer below and the announcement here https://dev-blog.apollodata.com/introducing-react-apollo-2-1-c837cc23d926 Read on for the…
rmarscher
  • 5,438
  • 1
  • 26
  • 30
12
votes
1 answer

How to resolve union/interface fields with GraphQL and ApolloStack

I am making use of interfaces with my GraphQL instance, but this question perhaps applies to unions as well. There are 2 common fields across all types which implement the interface, however there are multiple additional fields on each type. Given…
JustinN
  • 830
  • 1
  • 12
  • 28
10
votes
1 answer

How to handle Errors with the Apollo stack

I'm using the Apollo Stack with graphql-server-express and apollo-client. Because my backend is not perfect errors can appear and therefore I have to respond to a request with an error for that path. Till now my main problem was authentication and…
Kordon
  • 254
  • 2
  • 12
8
votes
1 answer

How to rehydrate my apollo state from server side?

I am totally new to react-apollo I am pretty confused that how to rehydrate state from the server side to client And my app is working, But the problem is it is not using preloaded state from Apollo After component rendered it is calling the API…
Nane
  • 1,361
  • 3
  • 23
  • 61
7
votes
0 answers

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

Apollo Client: Upsert mutation only modifies cache on update but not on create

I have an upsert query that gets triggered on either create or update. On update, Apollo integrates the result into the cache but on create it does not. Here is the query: export const UPSERT_NOTE_MUTATION = gql` mutation upsertNote($id: ID,…
7
votes
2 answers

Does Apollo Stack support global object identification like the node interface of Relay?

I am very new in both Apollo Stack and Relay. I am trying to choose between them to invest my time. After finish reading the book Learning GraphQL and Relay, I turned to Apollo to learn what it has to offer but right now there are not much resources…
kkkkkkk
  • 6,848
  • 2
  • 13
  • 27
6
votes
1 answer

How do I refetch a query outside of its wrapped component?

I have two screens: Screen1: Results Screen2: Edit Filters When I edit the filters on Screen2 and press back, I would like to refetch the query on Screen1 (with the newly built filter string variable). Editing the filters doesn't use a mutation or…
atkayla
  • 6,193
  • 11
  • 53
  • 99
6
votes
2 answers

After a mutation, how do I update the affected data across views?

I have both the getMovies query and addMovie mutation working. When addMovie happens though, I'm wondering how to best update the list of movies in "Edit Movies" and "My Profile" to reflect the changes. I just need a general/high-level overview, or…
atkayla
  • 6,193
  • 11
  • 53
  • 99
6
votes
4 answers

Setting Up Apollo Server with subscriptions-transport-ws?

It seems like I have my server set up according to the Apollo docs at http://dev.apollodata.com/tools/apollo-server/setup.html. In my server/main.js file: //SET UP APOLLO INCLUDING APOLLO PUBSUB const executableSchema = makeExecutableSchema({ …
VikR
  • 3,484
  • 3
  • 34
  • 70
1
2 3 4 5 6 7 8