apollo

Apollo React - `useMutation` in ApolloClient setup?

给你一囗甜甜゛ 提交于 2021-02-17 06:12:14
问题 I have an interesting situation. I want to initiate refresh token request USING Apollo itself (a.k.a to call a mutation) Any idea, how to achieve something like this? export default new ApolloClient({ link: ApolloLink.from([ onError(({ graphQLErrors, networkError, operation, forward }) => { // useMutation(REFRESH_ACCESS_TOKEN) }), ]), new HttpLink({...}), }) Basically I'm just trying to useMutation(REFRESH_ACCESS_TOKEN) inside onError while creating new ApolloClient instance. The problem:

How to conditionally include an argument in a GraphQL query?

不羁岁月 提交于 2021-02-17 06:00:46
问题 I have the following GraphQL query (using Apollo Client JS): query GetUsers($searchFilter: String) { users( first: 10, filter: { search: $searchFilter } ) { nodes { id name } } } This works well when I pass in the $searchFilter argument. However, I want this $searchFilter argument to be optional . So when it's null it doesn't apply the filter. This seems simple enough, but the API requires the search to be non-nullable. So passing in filter: { search: null } is not allowed. I would like to

How to handle apollo client errors crashing page render in Nuxt?

∥☆過路亽.° 提交于 2021-02-11 12:47:33
问题 I'm currently maintaining a production Nuxt.js Vue app that integrates GraphQL Apollo Client that's running into page render errors. For the sake of boosting my chances of getting a response, I built a bare-bones code example that showcases only the problem we are running into. Thanks everybody. Source Code Client, https://github.com/sgarcia-dev/error-apollo-client-nuxt Server, https://github.com/sgarcia-dev/error-apollo-server The Problem The problem, is that every now and then, the GraphQL

Missing movies attribute on result Vue GraphQL

倖福魔咒の 提交于 2021-02-11 12:37:47
问题 I am frontend developer so for the first time I got my hands on vue and graphql, I don’t know how exactly to deal with this error: Missing getMovies attribute on result {movies: Array(20)} Here is my code, and I can see the data is fetched successfully in the response on dev tools in chrome: {"data":{"movies":[{"__typename":"Movie","id":11,"overview": Here is the code: <template> <div class="hello"> <ul> <li v-for="movie in movies" :key="movie.id">{{movie.title}}</li> </ul> </div> </template>

Missing movies attribute on result Vue GraphQL

泄露秘密 提交于 2021-02-11 12:37:00
问题 I am frontend developer so for the first time I got my hands on vue and graphql, I don’t know how exactly to deal with this error: Missing getMovies attribute on result {movies: Array(20)} Here is my code, and I can see the data is fetched successfully in the response on dev tools in chrome: {"data":{"movies":[{"__typename":"Movie","id":11,"overview": Here is the code: <template> <div class="hello"> <ul> <li v-for="movie in movies" :key="movie.id">{{movie.title}}</li> </ul> </div> </template>

Can I create multiple elements of the same type using Strapi and GraphQL?

南笙酒味 提交于 2021-02-11 12:23:08
问题 Can I create multiple elements of the same type using Strapi and GraphQL? For example - createMultipleFoo mutation(data: [ nameOfFoo: "ooaoaoa", weightOfFoo: "aododo" ], ....) 回答1: It's in the roadmap. What you can do for now is create a custom endpoint ie. "createMulti". Send a json array, and use the "regular" create for each. Check out the discussion here. Any questions post a comment 来源: https://stackoverflow.com/questions/63260467/can-i-create-multiple-elements-of-the-same-type-using

Apollo Server Express: Request entity too large

风格不统一 提交于 2021-02-10 14:25:48
问题 I need to POST a large payload in a GraphQL mutation. How do I increase the body size limit of Apollo Server? I'm using apollo-server-express version 2.9.3. My code (simplified): const myGraphQLSchema = new GraphQLSchema({ query: new GraphQLObjectType({ name: 'Query', fields: { user: UserQuery, }, }), mutation: new GraphQLObjectType({ name: 'Mutation', fields: () => ({ ...UserMutations, }), }), }); const apolloServer = new ApolloServer(schema: myGraphQLSchema); const app = express(); app.use

Compatibility between cypress and react-apollo

人走茶凉 提交于 2021-02-10 14:22:59
问题 I am using react-apollo to make GraphQL queries, and I am using Cypress for testing. The problem is that these 2 dont seem to play well along. Apollo seems to be making all its requests through the Fetch API. But Cypress seems like it is not able to capture anything, except XHR requests. So what could I do to solve this problem? Is there a way for Cypress to capture "fetch" requests? Is there a way for react-apollo to use "xhr" instead of "fetch"? 回答1: Try out cypress-graphql-mock You just

`Extensions` field not shown in apollo graphql response data

我们两清 提交于 2021-02-10 13:20:30
问题 Here is a reproducible example. Run app.js and navigate the playground at http://localhost:4000/graphql You can run queries like: query RecipeQuery{ recipe(title:"Recipe 2"){ description } } Problem: I need debugging information from the extensions field in the response data. I'm talking about this extensions field: "data":{....}, "extensions": { "tracing": {} "cacheControl":{} } But in reality, I'm only getting the data field: "data":{....} I have already enabled tracing and cacheControl in

自动驾驶出租车全面开放,限时免费打车!

末鹿安然 提交于 2021-02-10 08:56:45
人工智能在很多领域为人类带来了便利,自动驾驶便是其中最火热的领域之一。 由于不容易体验到,不少人都觉得自动驾驶技术离现实生活还有一段距离。 但事实情况却并非如此,在技术和法规不断发展完善的背景下,自动驾驶技术已经进入了我们的生活。 早在2018年底,百度Apollo自动驾驶全场景车就已经在长沙亮相,并完成高速场景自动驾驶车路协同演示。 去年9月,百度便在长沙宣布,即日起,普通长沙市民可申请试乘体验自动驾驶出租车。 今年10月11日,百度官方宣布,即日起,百度自动驾驶出租车服务在北京全面开放。 北京的朋友们可在海淀区、亦庄的自动驾驶出租车站点,无需预约,直接下单免费试乘自动驾驶出租车服务。 此次的自动驾驶出租车活动时间为10月10日-11月6日,运营时段为周一至周日的10:00-16:00,法定节假日除外。 若想体验免费自动驾驶出租车的话,大家可以通过以下两种方式打车: 1、打开百度地图,选择“打车-自动驾驶-选择上下车站点-选择乘车人数-立即呼叫Apollo GO”等选项后,就能直接约车。 2、下载并打开Apollo GO的App,选择上下车站点 - 选择乘车人数 - 立即呼叫Apollo GO。 根据百度官方介绍,用户参与乘车体验后,还可在工作人员处领取礼品。 需要再次提醒大家的是,当前的百度自动驾驶出租车服务体验,上下车均需要在指定的数十个站点。 如果不清楚指定乘车点