apollo

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

ⅰ亾dé卋堺 提交于 2019-12-25 07:46:55
问题 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!) { createMessage(text: $text, sentById: $sentById) { id text } } ` const allMessages = gql` query allMessages { allMessages { id text createdAt sentBy { name location { latitude longitude } } } } ` Then, when exporting, I'm wrapping my Chat component like so: export

http parse exception apollo Graphql

老子叫甜甜 提交于 2019-12-25 04:11:38
问题 I am getting http parse exception while using Apollo GraphQL Client for Android, but i can able to see json data with status code 200 when debugging with HttpLoggingInterceptor Anyone went over this issue? Below is the method to call graphql query private void getData(){ HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor() .setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient httpClient = new OkHttpClient.Builder() .addInterceptor(interceptor) .build(); ApolloClient

Why is my apolloFetch call returning an empty query when called from within a promise.all?

风流意气都作罢 提交于 2019-12-25 03:12:46
问题 I'm trying to use apolloFetch inside a Promise.all in my Node.js microservice but keep getting an error that the query is empty. The reason for using apolloFetch is to call another micro service and pass it an array of queries. Can someone give me some direction? My code is as follows: const uri = "dsc.xxx.yyyy.com/abc/def/graphql"; const apolloFetch = CreateApolloFetch({uri}); const QryAllBooks = { type: new GraphQLList(BookType), args: {}, resolve() { return new Promise((resolve, reject) =>

React Apollo Error: Invariant Violation: Could not find “client” in the context or passed in as an option

独自空忆成欢 提交于 2019-12-25 01:52:23
问题 I'm building a project using React, Apollo and Next.js. I'm trying to update react-apollo to 3.1.3 and I'm now getting the following error when viewing the site. Invariant Violation: Could not find "client" in the context or passed in as an option. Wrap the root component in an , or pass an ApolloClient instance in via options. If I downgrade the react-apollo package to 2.5.8 it works without issue so I'm thinking something has changed between 2.5 and 3.x but can't find anything in the react

React-Native + Apollo-Link-State + AWS Appsync : Defaults are not stored in cache

元气小坏坏 提交于 2019-12-25 00:16:05
问题 I'm struggling with this for days. I've successfully configure Apollo-Link-State with AppSync a month ago and start adding defaults and resolvers like this : const cache = new InMemoryCache() //create the cache to be shared by appsync and apollo-link-state const appSyncAtrributes = { //... //setup appSync } const stateLink = createLinkWithCache(() => withClientState({ cache, resolvers: { Mutation: { updateCurrentUser: (_, { username, thumbnailUrl }, { cache }) => { // ... // working mutation

React Apollo - Strange Effect When Making Mutation?

荒凉一梦 提交于 2019-12-24 09:19:08
问题 I've set up a React application with React-Apollo and can successfully query my API. However, when I make a mutation, a strange effect occurs. I get all the data back successfully (as seen in the Network tab of the Chrome Dev Tools), but when trying to console.log the data, it says that it is null . Here's the relevant code: // mutation file import gql from "graphql-tag"; export default gql` mutation CreateReservation($name: String!, $time: String!, $persons: String, $specialMessage: String,

Reach child does not update when state changes

佐手、 提交于 2019-12-24 07:51:54
问题 I have created a code snippet to demonstrate the issue: https://codesandbox.io/s/o1v4qxw3yy Essentially the checkedValues (an array of ids) does not get passed to the ChildComponent when a checkbox is clicked. Unless I send another variable along with it. If you uncomment the cat line @32 in the ParentComponent, it all starts working. I have noticed that the Apollo HOC around the ChildComponent receives the new value live , but the ChildComponent does not update unless another state change is

Check-and-run-apollo-codegen.sh for Apollo not working?

天涯浪子 提交于 2019-12-24 06:49:09
问题 I am trying to install Apollo in my iOS Project. I follow the instructions here: https://www.apollographql.com/docs/ios/installation.html. When I complete the "Adding a Code Generation Build Step," I get an error. It cannot find the file check-and-run-apollo-cli.sh. The error is "Command PhaseScriptExecution failed with a nonzero exit code." So I checked the file path it was giving me. It seems that "check-and-run-apollo-cli.sh" doesn't exist, but "check-and-run-apollo-codegen.sh" does. So I

Best way to access Apollo GraphQL client inside redux action creators?

安稳与你 提交于 2019-12-24 06:12:46
问题 In the (untested) example code below, if I want to access an instance of the Apollo GraphQL client inside actions/math.js , I have to pass it from the Calculator component to event handlers, and from the WrappedCalculator event handlers to the action creators. This results in a lot of code bloat. What would be a better way for actions/math.js action creators to access the GraphQL client instance? Example code: constants/Queries.js : const MUTATION_APPEND_TO_AUDIT_TRAIL = gql` mutation

Apollo Server, Graphql - Must provide query string

杀马特。学长 韩版系。学妹 提交于 2019-12-24 03:25:10
问题 Im not sure what im doing wrong here? I've been stuck now for soem time on getting my mutations to run with my apollo-server-lambda in my serverless setup, my queries works fine bu when i try to run a query like this: { "mutation": "{ signIn(username: \"SomeUser\", password: \"SomePassword\" ) { token } }" } I just get the message: " Must provide query string." status 400. I've set up my resolver like so: const resolvers = { Query: { users: async (_, args, ctx) => User.load(args, ctx) },