apollo

Modeling optional filter params in react-apollo

元气小坏坏 提交于 2019-12-08 12:23:16
问题 I am using react-apollo to access a graphql in a web app. I have a query that looks like this that allows me to filter a schedule of games: query($pagination:Int!, $divisionId:ID, $teamId:ID, $startDate:DateTime!, $endDate:DateTime! ){ games: allGames ( orderBy: date_ASC, first: $pagination, filter: { date_gte: $startDate, date_lte: $endDate, division: {id: $divisionId}, OR: [ {homeTeam: {id: $teamId} }, {awayTeam: {id: $teamId} }, ] } ){ id .... more fields } The startDate and endDate

How to share cached apollo-client data with another query

北城以北 提交于 2019-12-08 11:56:27
问题 I'm using apollo-client@2.3.x (& react-apollo@2.1.x ), with the standard InMemoryCache , to query a Shopify store via their GraphQL Storefront API. I have two queries: 1. getProducts (in <Home /> ), and 2. getProduct($id) (in <ProductDetail /> ). In the scenario starts on <Home /> , then clicks on a product, I'd like the <ProductDetail /> component to show the cached response from query 1 before query 2 runs. Demo: https://shopify-storefront-example-rdfwtslzng.now.sh/ Source: https://shopify

Apollo activemq AMQP NullPointerException

别说谁变了你拦得住时间么 提交于 2019-12-08 05:22:58
问题 Getting following exception while trying to post a Java object. Any pointers are appreciated. > 2015-12-26 23:06:32,876 | WARN | stackref=151df5b0a0f > java.lang.NullPointerException at > org.apache.activemq.apollo.broker.QueueEntry$Swapped.swapped_in(QueueEntry.scala:809) > at > org.apache.activemq.apollo.broker.QueueEntry$Swapped$$anonfun$swap_in$1$$anonfun$apply$2.apply$mcV$sp(QueueEntry.scala:764) > at > org.apache.activemq.apollo.util.DeferringDispatched$$anon$1.run(Dispatched.scala:38)

Is graphql schema circular reference an anti-pattern?

为君一笑 提交于 2019-12-08 01:32:21
问题 graphql schema like this: type User { id: ID! location: Location } type Location { id: ID! user: User } Now, the client sends a graphql query. Theoretically, the User and Location can circular reference each other infinitely. I think it's an anti-pattern. For my known, there is no middleware or way to limit the nesting depth of query both in graphql and apollo community. This infinite nesting depth query will cost a lot of resources for my system, like bandwidth, hardware, performance. Not

ApolloGraphql FileNotFoundException: source/apollo/generatedIR/debug/src (Is a directory)

跟風遠走 提交于 2019-12-07 20:16:48
问题 I am trying to add ApolloGraphql to my android project, but when i try to rebuild the project, i get : org.gradle.api.UncheckedIOException: java.io.FileNotFoundException: /Users/mcebotari/Downloads/Projects/Barcloud/app/build/generated/source/apollo/generatedIR/snapshotDebug/src (Is a directory) in build.gradle i have added the needed dependencies: apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply

How to write to apollo cache from within React component with out losing context of “this”

[亡魂溺海] 提交于 2019-12-07 18:59:53
问题 I'm having trouble trying to read from apollo cache from within a react component the mutation works and writes to my server and returns the data but when passed to my update function it seems to lose the context of this when in inMemoryCache.js "apollo-cache-inmemory": "^1.2.5" "react-apollo": "^2.1.4" "apollo-boost": "^0.1.7" TypeError: Cannot read property 'read' of undefined at ./node_modules/apollo-cache-inmemory/lib/inMemoryCache.js.InMemoryCache.readQuery import React, { Component }

How do I update the Apollo data store/cache from a mutation query, the update option doesn't seem to trigger

℡╲_俬逩灬. 提交于 2019-12-07 13:51:31
问题 I have a higher order component in my react native application that retrieves a Profile. When I call an "add follower" mutation, I want it to update the Profile to reflect the new follower in it's followers collection. How do I trigger the update to the store manually. I could refetch the entire profile object but would prefer to just do the insertion client-side without a network refetch. Currently, when I trigger the mutation, the Profile doesn't reflect the change in the screen. It looks

How do you type partial types in a TypeScript Angular application using an Apollo backend?

99封情书 提交于 2019-12-07 10:33:30
Edit: I'm looking for an authority and sourced answer from Graphql-Angular community to provide a best practice example. For example, we have a Person type defined as such in TypeScript: interface Person { firstName: string; lastName: string; birthDate: Date; age: number; ...and many more attributes } Let's say you have a component, and in accordance to the graphql mantra, you only fetch what you need. No overfetching and underfetching. I only need the Person 's firstName and age , so I make that in my Apollo Query. Now, how do I type this Object that I just fetched? The structure is a partial

GraphQL - How to chain queries and mutations? [duplicate]

こ雲淡風輕ζ 提交于 2019-12-07 05:34:10
问题 This question already has answers here : How to chain two GraphQL queries in sequence using Apollo Client (2 answers) Closed last month . In my graphQL schema, I have a relationship between two objects. Say Humans and Cats. Humans have many Cats and Cats have one human. If I want to create a new Cat belonging to a human, I need to query for the human by ID and then I need to use that ID to do a mutation to create the cat. How can I chain these together? It seems simple but can't find an

GraphQL union and conflicting types

无人久伴 提交于 2019-12-06 18:49:13
问题 I've got an issue on my project and I can't find any solution on the internet. Here is the situation. I've an Union ( DataResult ) of 2 types ( Teaser & Program ) I've a Zone type with a data field (an array DataResult ) Teaser & Program have the same title field with a different type ( String vs String! ) Here is parts from Zone , Teaser and Program schemas: type Program { title: String } type Teaser { title: String! } union DataResult = Teaser | Program type Zone { (...) data: [DataResult!]