graphcool

GraphQL: Subscription not firing when mutation run

风格不统一 提交于 2019-12-12 21:05:09
问题 So, I'm testing subscriptions on Graphcool and would appreciate some clarification on how exactly they work. I have a one to many relationship from Posts on Comments: Schema type Posts { caption: String! comments: [Comments!]! @relation(name: "PostsOnComments") createdAt: DateTime! displaysrc: String! id: ID! likes: Int updatedAt: DateTime! } type Comments { createdAt: DateTime! id: ID! posts: Posts @relation(name: "PostsOnComments") text: String! updatedAt: DateTime! user: String! } The

React relay injectNetworkLayer is not a function

删除回忆录丶 提交于 2019-12-12 17:57:35
问题 I am following the tutorial from lynda: "Building and Deploying a Full-Stack React Application", in the chapter "Injecting the Relay Network Layer". there is in index.js, an attempt to set up a network layer, and the program compiles successfully but I'm receiving the following error in the browser: TypeError: __WEBPACK_IMPORTED_MODULE_4_react_relay___default.a.injectNetworkLayer is not a function index.js file is: import React from 'react' import ReactDOM from 'react-dom' import {Router,

nested object in graphcool

∥☆過路亽.° 提交于 2019-12-11 17:35:08
问题 I have a model like this: type User @model { id: ID! @isUnique } Now I want to add a nested object: type User @model { id: ID! @isUnique position: { lat: Int lng: Int } } but I get a error from Graphcool, {", expected IgnoredNoComment, ImplementsInterfaces or Directives (line 4, column 11): type User @model { ^ Why? can't I pass a nested object? In this way I can update the mutation simply passing the object with lat and lng. What is wrong with this? 回答1: For nested structure you need to

How to update all records in a collection using graphql

时光怂恿深爱的人放手 提交于 2019-12-04 09:25:44
I'm using Graph.cool graphql as a service and am wondering how to do a mass update to the collection, similar to a SQL update. In my case I need to update the suffix of a url, in the imageUrl column of my database. I need to swap out a {someid}_sm.jpg to {someid}_lg.jpg How do I do that with a graphql mutation? I don't want to reload the entire dataset again and am looking for a way to do it that doesn't involve manually interating through the entire list with a graphql client. mutation { updatePost() // what goes here? } marktani Migration script The best approach is indeed to use a migration

How to chain two GraphQL queries in sequence using Apollo Client

£可爱£侵袭症+ 提交于 2019-11-26 14:00:10
问题 I am using Apollo Client for the frontend and Graphcool for the backend. There are two queries firstQuery and secondQuery that I want them to be called in sequence when the page opens. Here is the sample code (the definition of TestPage component is not listed here): export default compose( graphql(firstQuery, { name: 'firstQuery' }), graphql(secondQuery, { name: 'secondQuery' , options: (ownProps) => ({ variables: { var1: *getValueFromFirstQuery* } }) }) )(withRouter(TestPage)) I need to get