relayjs

How to use subscription of GraphQL in Graphql.js

浪尽此生 提交于 2020-01-12 11:10:33
问题 I am using relay-fullstack. It's using GraphQL.js . I want use subscription of GraphQL in GraphQL.js . But I can't find documents about subscription of GraphQL in GraphQL.js. Can I use subscription of GraphQL in GraphQL.js ? Or does not it support that? 回答1: Yes you can! I created a simple repository based on Facebook relay-examples todo relay modern with subscriptions support (server and client), you can check it out, I might also improve it in the future: https://github.com/jeremy-colin

How to use subscription of GraphQL in Graphql.js

ぐ巨炮叔叔 提交于 2020-01-12 11:08:26
问题 I am using relay-fullstack. It's using GraphQL.js . I want use subscription of GraphQL in GraphQL.js . But I can't find documents about subscription of GraphQL in GraphQL.js. Can I use subscription of GraphQL in GraphQL.js ? Or does not it support that? 回答1: Yes you can! I created a simple repository based on Facebook relay-examples todo relay modern with subscriptions support (server and client), you can check it out, I might also improve it in the future: https://github.com/jeremy-colin

Relayjs fatquery not generating expected query

≡放荡痞女 提交于 2020-01-06 07:43:12
问题 I have a pseudo structure that looks/works a bit like this: Organization <- OrganizationType { TopLevelEmployees <- EmployeeType { id, Name, Pay, Subordinates <- EmployeeType { id, Name, Pay, Subordinates.if(variables.expanded) } }, Departments <- DepartmentType { Name, Organization, <- OrganizationType Employees } } I have a control that displays the Employee tree structure <EmployeeTreeEditor Organization={organization} /> I then have a control that edits departments individually

Connection is based on `array`,is this a design style guide for design a relay server?

馋奶兔 提交于 2020-01-05 09:09:41
问题 In connection/arrayconnection.js , It seems all the function is tend to work with array . For example: offsetToCursor is the only way to generate Cursor. Does this mean its a design pattern i must follow, or imply that i should generate Cursor by myself when using something other than array .If im planning to use Mongodb,should i make the database interface like an static array ? BTW: As a newbie to web develop, im a bit confused how to implement a qualified relay server. Are there some guide

Error loading graphql with react-relay modern

▼魔方 西西 提交于 2020-01-05 05:52:09
问题 I am developing an react-native application using Relay for working with graphql. Before earlier versions I have been using Relay classic with RootContainer and renderer following the 'sibelius' react-native-relay-example also combined with these two posts: first and second. So I have changed the react-relay version from 0.10.0 to 1.0.0 and for starters put a simple query at first screen using relay modern implementation. I did not change babel-relay-plugin. When ever I run the app I get

How to transpile a Relay query from TypeScript to ES5?

自闭症网瘾萝莉.ら 提交于 2020-01-04 02:19:08
问题 I'm writing a web app in TypeScript. The app uses React and Relay from Facebook. My TypeScript source code gets compiled into ES6 code using the TypeScript compiler TSC. Then, the ES6 code gets transpiled into ES5 code using Babel. In order for Relay to work in the browser, a Babel plugin needs to transform the Relay GraphQL queries: https://facebook.github.io/relay/docs/guides-babel-plugin.html. The problem is, because TSC first transpiles these queries, the Babel Relay plugin doesn't

Relay/GraphQL add custom field to connection

点点圈 提交于 2020-01-03 06:42:11
问题 I am trying to add the totalcount of records to be used for pagination. Right now i can see the connection i am having trouble modifying it to get my totalCount to be apart of it. Books: { type: BooksConnection.connectionType, args: { ...connectionArgs, isbn: { type: GraphQLString }, publisher: {type: GraphQLString}}, resolve: ( obj, { ...args }, context, { rootValue: objectManager } ) => { let user = obj; let FormatedArgs = MasterFields.FormatPredicate(args); return objectManager.getListBy(

Refetch method for createRefetchContainer doesn't execute callback

六眼飞鱼酱① 提交于 2019-12-24 18:51:29
问题 My QueryRenderer uses the following Query: ``` graphql` query page_Query { viewer { id ...MountedRenderer_viewer } } ` and this is what my createRefetchContainer looks like: ``` createRefetchContainer( MountComponent, graphql` fragment MountedRenderer_viewer on User @argumentDefinitions(show: { type: "Boolean", defaultValue: false }) { id name @include(if: $show) } `, graphql` query OwnershipsRenderer_Query($show: Boolean!) { viewer { ...MountedRenderer_viewer @arguments(show: $show) } } `, )

How to best access data from QueryRenderer in a parent component in Relay Modern?

只愿长相守 提交于 2019-12-24 12:24:26
问题 As you can see from the picture below, I'm rendering the popover using a react-relay QueryRenderer since the request is slow, and I do not want the rest of the page to wait for events to be fetched. My problem is that in the navigation I have a button to show/hide the popover. That button should only be rendered when events has loaded, and the button also needs to show a count of how many events there is. So my question is how to pass events data up from QueryRenderer (popover) to a parent

Edge.node field type must be Output Type but got: undefined

我只是一个虾纸丫 提交于 2019-12-23 10:58:27
问题 I'm trying to set up a node.js server with a Relay-compatible GraphQL schema. When trying to validate or load the schema I get the following error: EventEdge.node field type must be Output Type but got: undefined. This is caused by having a connection type for for the Event type in one of the other type definitions. I won't post the whole schema because it's quite verbose but when the connection field is commented out the schema is loaded correctly and no errors are thrown. I've included an