apollo

Apollo Optimistic UI does not work in Mutation Component?

Deadly 提交于 2019-12-10 12:29:14
问题 I am using <Mutation /> component which has Render Prop API & trying to do Optimistic Response in the UI. So far I have this chunk in an _onSubmit function - createApp({ variables: { id: uuid(), name, link }, optimisticResponse: { __typename: "Mutation", createApp: { __typename: "App", id: negativeRandom(), name, link } } }); And my <Mutation /> component looks like - <Mutation mutation={CREATE_APP} update={(cache, { data: { createApp } }) => { const data = cache.readQuery({ query: LIST_APPS

Redux-thunk: `dispatch is not a function`

杀马特。学长 韩版系。学妹 提交于 2019-12-10 11:38:24
问题 So, I'm having an issue with an action returning the above mentioned error (See attached image), instead of updating redux state as expected. What am I overlooking here? actionCreators.js export function userToken(token) { console.log('userToken has been fired'); return (dispatch) => { dispatch({ type: 'Graphcool_Token', payload: token }); } } App.js .... // Root Query const allPostsCommentsQuery = graphql(All_Posts_Comments_Query, { options: { cachePolicy: 'offline-critical', fetchPolicy:

ActiveMQ to Apollo transition, Openwire to Stomp protocol configuration

折月煮酒 提交于 2019-12-10 10:47:55
问题 I'm trying to switch from ActiveMQ 5.6 to Apollo 1.5. I have two soft that are exchanging messages, using publish/subscribe on topics. The first one is c++ and use openwire with tcp The second one is Javascript and use stomp with websockets With ActiveMQ everything worked fine, and the messages I sent could be read and write on both softs, and I didn't changed the clients since. Now, I send messages from the c++ soft (using openwire), and try to read them with the JS soft, and I get errors.

apollo-link-state cache.writedata results in Missing field warning

守給你的承諾、 提交于 2019-12-10 04:06:46
问题 When I call a mutation on my client I get the following warning: writeToStore.js:111 Missing field updateLocale in {} This is my stateLink: const stateLink = withClientState({ cache, resolvers: { Mutation: { updateLocale: (root, { locale }, context) => { context.cache.writeData({ data: { language: { __typename: 'Language', locale, }, }, }); }, }, }, defaults: { language: { __typename: 'Language', locale: 'nl', }, }, }); And this is my component: export default graphql(gql` mutation

GraphQL dynamic query building

风流意气都作罢 提交于 2019-12-10 01:44:41
问题 I have a GraphQL server which is able to serve timeseries data for a specified source (for example, sensor data). An example query to fetch the data for a sensor might be: query fetchData { timeseriesData(sourceId: "source1") { data { time value } } } In my frontend, I want to allow the user to select 1 or more sources and show a chart with a line for each one. It seems like this would be possible by using a query like this: query fetchData { series1: timeseriesData(sourceId: "source1") {

Reset store after logout with Apollo client

狂风中的少年 提交于 2019-12-09 17:59:02
问题 I'm trying to reset the store after logout in my react-apollo application. So I've created a method called "logout" which is called when I click on a button (and passed by the 'onDisconnect' props). To do that I've tried to follow this example : https://www.apollographql.com/docs/react/recipes/authentication.html But in my case I want LayoutComponent as HOC (and it's without graphQL Query). Here is my component : import React, {Component} from 'react'; import { withApollo, graphql } from

React-Apollo, don't run query on component load

落爺英雄遲暮 提交于 2019-12-09 16:50:07
问题 I'm using the awesome https://github.com/apollographql/react-apollo library and I'm trying to see if there is a better convention to load data into components than how I'm doing it now. I've set up my components to with the apollo HOC to load data into my components, like so: const mainQuery = gql` query currentProfileData($userId:String, $communityId:String!){ created: communities(id:$communityId) { opportunities{ submittedDate approvalDate status opportunity{ id } } } } `; const

Max MQTT connections

拟墨画扇 提交于 2019-12-09 06:02:56
问题 I have a need to create a server farm that can handle 5+ million connections, 5+ million topics (one per client), process 300k messages/sec. I tried to see what various message brokers were capable so I am currently using two RHEL EC2 instances (r3.4xlarge) to make lots of available resources. So you do not need to look it up, it has 16vCPU, 122GB RAM. I am nowhere near that limit in usage. I am unable to pass the 600k connections limit. Since there doesn't seem to be any O/S limitation

How to chain together Mutations in apollo client

﹥>﹥吖頭↗ 提交于 2019-12-09 00:42:12
问题 I have a bunch of information stored in my state that I need to pass to my graphQL server using mutations, but I need to use the results of each mutation before I call the next one since I need to: Create a new object in my database Use the id generated for that object to create another object Modify the original object to store the id generated by the second object I noticed that apollo Mutation components have an onCompleted callback, but I don't know how to use this callback to fire off

Apollo mutate calling update four times for a single mutation

蓝咒 提交于 2019-12-08 19:12:28
Every time I add a new item in my app, the mutation calls update() four times, for some reason. The first two are optimistic data, and in the second batch, one is optimistic and one is real data from the network. I can't make any sense of this. The new item being created shows up twice on the page. This is my mutation: mutation CreateTrack($name: String!, $trackNum: Int, $s3Key: String!) { createTrack(name: $name, trackNum: $trackNum, s3Key: $s3Key) { trackId name createdAt duration trackNum s3Key isProcessing didProcessingFail } } And this is the mutation code: createTrack({ name, s3Key }) {