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
1
vote
1 answer

Apollo/GraphQL Mutation Works in GraphIQL, but Not in Client Code?

I have this mutation working correctly in GraphIQL at http://localhost:8080/graphiql: QUERY mutation($fromID: String!, $toID: String!, $msgText: String!){ createIM(fromID: $fromID, toID: $toID, msgText: $msgText){ fromID toID msgText …
VikR
  • 4,818
  • 8
  • 51
  • 96
0
votes
1 answer

How to delete cache record from Apollo GraphQL client with readQuery and writeQuery

The Apollo GraphQL team says that readQuery and writeQuery are good for 95% of the use cases. I am using useMutation and update and want to remove an item from a cache without having to call refetchQueries. My code is as follows: const…
Pete
  • 3,111
  • 6
  • 20
  • 43
0
votes
1 answer

How to pass the Header while calling the Apollo Query?

I'm trying to pass the token inside the header while calling the apollo query for graphql inside the vue application. But this is not working. I don't want to add header inside the main.js as we need to store it inside the localstorage of the…
0
votes
1 answer

GraphQL: Field Resolver Not Firing on Subscription Query?

I've got a subscription query, MessageFolder_Subscription, that looks like this: QUERY const MESSAGEFOLDER_SUBSCRIPTION_QUERY = gql` subscription ($localUserID: String!){ MessageFolder_Subscription(userID: $localUserID){ id …
VikR
  • 4,818
  • 8
  • 51
  • 96
0
votes
1 answer

Automatic persisted query in Apollo Client and Server is not working getting PERSISTED_QUERY_NOT_FOUND error

I tried to use highly advertised Automatic persisted query for performance benefits in Graphql based system but after spending three days I couldn't fix below problem. Apollo documents has lots of 404 pages for this topic if you try to look up - On…
WitVault
  • 23,445
  • 19
  • 103
  • 133
0
votes
1 answer

apollo-client: How to get inverse relation from cache?

I have a graphql query response of the shape { table { id legs { id } } This normalizes to table and leg entries in my InMemoryCache. But then if my application retrieves a leg from cache and needs to know the corresponding…
bebbi
  • 2,489
  • 3
  • 22
  • 36
0
votes
2 answers

How to refetch a query from a different component without a mutation?

Say I have some component with a query that fetches something: {({ loading, error, data, refetch }) => { if (loading) return Loading...; if (error) return…
atkayla
  • 8,143
  • 17
  • 72
  • 132
0
votes
1 answer

apollo react: proper way to switch a query's params

In my app I have a sidebar with a list of "saved searches" and a central area that should show the results of a search. Whenever I click on a saved search link, I want to update the central area with the results of that search. What is the proper…
Dan Caragea
  • 1,784
  • 1
  • 19
  • 24
0
votes
1 answer

Apollo GraphQL: Setting Port for HTTPBatchedNetworkInterface?

I'm trying to connect to a local dev environment via an IP address. I'm getting an error because HTTPBatchedNetworkInterface shows: _uri: "http://10.0.1.10/graphql" ...when it needs to be: "http://10.0.1.10:3000/graphql" Here's my server-side setup…
VikR
  • 4,818
  • 8
  • 51
  • 96
0
votes
1 answer

Apollo: How to Sort Subscription Results in UpdateQuery?

Here is a working Apollo subscription handler: componentDidMount() { const fromID = Meteor.userId(); const {toID} = this.props; this.toID = toID; this.props.data.subscribeToMore({ document: IM_SUBSCRIPTION_QUERY, …
VikR
  • 4,818
  • 8
  • 51
  • 96
0
votes
1 answer

Apollo: Defining `params` in withData?

I'm learning the latest Apollo libs. This withData code is adapted from the Githunt-React Apollo demo: const withData = graphql(GETIMS_QUERY, { options: ({ params }) => { console.log(params); return { variables: { …
VikR
  • 4,818
  • 8
  • 51
  • 96
0
votes
1 answer

Correct Way to Move Mutate() from ApolloClient to React Component?

Per the Apollo Docs, I'd like to get the mutate() function from ApolloClient into the props belonging to my react component. Is this the correct/preferred way to do it? class myComponent extends React.Component { constructor(props) { …
VikR
  • 4,818
  • 8
  • 51
  • 96
0
votes
1 answer

Apollo GraphQL: Can One Query Support Lookup Different Lookup Fields?

I've got a working query that looks like this: const GETONEASSOCIATE_QUERY = gql` query getOneAssociate($_id: String!) { getOneAssociate(_id: $_id) { _id first_name last_name city state userIDinRelatedTable } } `; Now…
VikR
  • 4,818
  • 8
  • 51
  • 96
0
votes
1 answer

Graphql resolve mapping with makeExecutableSchema

I am having problems trying to resolve fields inside a GraphQL type. So, here I am trying to resolve the find property of patientQuery const gqlSchema = makeExecutableSchema({ typeDefs: ` type patientQuery { find: [String] findOne:…
Shalkam
  • 733
  • 6
  • 12
0
votes
2 answers

Issue with automatic UI updates in Apollo: `updateQuery` not working properly with `subscribeToMore`

I'm using GraphQL subscriptions for my chat application, but I have an issue with the UI updates. Here are the query and the mutation I'm using: const createMessage = gql` mutation createMessage($text: String!, $sentById: ID!) { …
nburk
  • 22,409
  • 18
  • 87
  • 132