relayjs

Reusing a Mutation in Relay

南楼画角 提交于 2019-12-11 05:08:28
问题 Is it possible to reuse a mutation? Let's say there exists a mutation UpdateItemMutation which I'm passing props to, but sometimes I just want to update a specific attribute. i.e. I want to be able to do: UpdateItemMutation({prop1: 'Data', prop2: 'Data2'}) UpdateItemMutation({prop1: 'Data'}) UpdateItemMutation({prop2: 'Data2'}) Unfortunately, my optimistic config complains since I'm passing an undefined to it. Also, since I have to take into account for the mutation updating everything, this

How to update Relay store without pushing to server

你。 提交于 2019-12-11 03:37:26
问题 I have a form in my React/Relay app that I am using to modify some fields. I don't want to send a server update every time a new letter is typed into an input. How can I use Relay to support the application state without always pushing to the server? Having read through most of the Relay docs it seems to me that I have to basically copy the Relay state either to the local state of my form or to some other Flux store, deal with changing it in there, and then commit it into Relay. That seems

Not getting payload after React-relay nested mutation

北战南征 提交于 2019-12-11 00:50:50
问题 This is a follow-up question to this answer posted earlier on SO about a react-relay mutation warning. "In you case what you have to do is to add the FeatureLabelNameMutation getFragment to your AddCampaignFeatureLabelMutation query." As with the OP in that question, I too want to make a nested relay mutation and I've tried doing what @Christine is suggesting, but I'm uncertain on where exactly to put the getFragment part. In my application, I want to create a "task" with multiple nested "sub

How to use Relay in combination with complex local state in client-side store

不羁的心 提交于 2019-12-10 23:41:28
问题 According to https://stackoverflow.com/a/34958818/3589182 Relay should work fine when combined with complex local state in client-side store. I'm having trouble finding an appropriate pattern to integrate the two. It seems like the main way to handle interactions with Relay is this.props.relay.setVariables, but that puts the client state inside the Relay container. If I maintain the state in a client store, I still need to notify the relevant Relay containers that their variables have changed

Error: field type must be Input Type - cannot pass qlType into mutation

假如想象 提交于 2019-12-10 19:36:39
问题 I want to update a person with the UpdatePerson mutation. I don't want to specify each and every property in the inputFields - but rather want to pass the complete person object. When I do that I get Error: UpdatePersonInput.person field type must be Input Type but got: Person. Is there no way to pass complete objects rather than all of their properties to a mutation? If there isn't, could you add one - because the amount of repetition of fields across a larger app with bigger objects can

Response of a GraphQL query/mutation

落爺英雄遲暮 提交于 2019-12-10 16:00:08
问题 I have a question concering how the response of a GraphQL query/mutation should look like in each of the following cases: There is a result, no errors Something went wrong, one or more errors There is both a result and some errors I'm not sure the latter is even possible, but I seem to remember reading somewhere that it could happen. E.g. in the case of multiple mutations, let's say two, where each mutation is processed sequentially. I think case #3 from above could happen if the first

Should the opaque cursors in connections be stable across different field args?

旧城冷巷雨未停 提交于 2019-12-10 10:35:08
问题 The RANGE_ADD mutation requires an edgeName so that it can insert the new edge into the client side connection. As part of its query, it also includes the cursor . The issue is that the server has no way of knowing which args the client might be applying to a connection when it's generating the edge response. Does this mean that the cursor should be stable? 回答1: In general, cursors are not required to be the same when connections are used with different arguments. For example, if I did: {

Relay Modern nested pagination

别来无恙 提交于 2019-12-09 07:14:22
问题 I have a root query of songs , this is in a pagination container. I then have a nested property on songs called comments that I also want to be paginated because I don't want to load 10k comments for each song all at once. songsContainer.js: fragment songsContainer on Query { songs( first: $count after: $cursor genre: $genre filter: $filter ) @connection(key: "songsContainer_songs") { edges { node { audioId name coverImageUrl artist likes dislikes ...commentsContainer } } } } const

Fetch additional data for a single item in a list query

牧云@^-^@ 提交于 2019-12-07 22:44:38
问题 Im trying to do something like this with React and Relay - smooth animation from list to single item. I currently have list component (list query) and single item component (node query) but there's a problem: these are two different, isolated views and queries, I can't think of an easy way to smootly animate between these two views. Easiest way would probably be to transform / scale that same list item: React part is simple, I'll calculate screen size on click and transform the list item to

How to build a web app with GraphQL + parse.com? [closed]

纵饮孤独 提交于 2019-12-07 14:48:07
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I would like to use parse and graphQL for a new app. It will essentially work with non logged in users, where people share a link and collaborate on some add hoc item. This will plan a meeting at a certain location. IS anyone aware of a solution or know of a way to approach this?