Questions tagged [relayjs]

Relay is a JavaScript framework for building data-driven React applications

Declarative: Never again communicate with your data store using an imperative API. Simply declare your data requirements using GraphQL and let Relay figure out how and when to fetch your data.

Colocation: Queries live next to the views that rely on them, so you can easily reason about your app. Relay aggregates queries into efficient network requests to fetch only what you need.

Mutations: Relay lets you mutate data on the client and server using GraphQL mutations, and offers automatic data consistency, optimistic updates, and error handling.

Resources

Code: https://github.com/facebook/relay
Docs: https://facebook.github.io/relay/
Chat: https://reactiflux.slack.com/messages/relay/ (Get an invite here)

686 questions
0
votes
0 answers

Updating a react control built from multiple sources

I would like to build an editable table that contains columns that are from multiple subtrees of the graphql data returned by relay. I have a control that creates an intermediate object for each of the rows from the relay data and stores the list in…
Reyn
  • 261
  • 1
  • 3
  • 10
0
votes
2 answers

'this' undefined in Reflux.createStore()

I'm trying to set state properties via this in my Reflux store, but whenever I attempt to set a property I get the following error: Uncaught TypeError: Cannot read property 'triggers' of undefined I've using Babel to compile my JSX, so not sure if…
Steven Bennett
  • 169
  • 3
  • 15
0
votes
1 answer

Multiple Relay Containers and Variables communication

I'm trying to change variables of a Relay Container from another Relay Container. They don't have a parent-child relation and both are in two separated Root Containers. Container = Relay.createContainer(Component, { initialVariables: { value:…
Inacio Schweller
  • 1,846
  • 9
  • 20
0
votes
1 answer

Props value after receiving setVariables callback

I have a question for the following scenario: If you use the setVariables method from the relay prop and change the variable in the way, that relay has to retrieve additional data from the server (for example click "load more stories" in the…
0
votes
1 answer

How to implement long polling with Relay?

Every 15 seconds, I need to refresh the data in all the fragments on one of my Relay containers. Is there a simple way to do this? I have tried relay.forceFetch({...}) but this error occurs: Uncaught Invariant Violation:…
Greg Ziegan
  • 5
  • 1
  • 2
0
votes
1 answer

How do you retry a relay transaction

How do I tell relay that it should retry a transaction that failed?
0
votes
0 answers

"Expected an argument name for root field" - how to fix this error?

In my React app I'm trying to use Relay to fetch a document (artwork) via id, but I'm getting an error: Invariant Violation: printRelayOSSQuery(): Expected an argument name for root field `artwork`. I'm using graffiti-mongoose as the server and my…
0
votes
1 answer

React Relay manipulation with list

Structure is store: (Component) => Relay.QL` query StoreQuery { store { ${Component.getFragment('store')} }, } `, store: () => Relay.QL` fragment on Store { activities { ${Activity.getFragment('activity')} }, …
ButuzGOL
  • 1,113
  • 2
  • 11
  • 25
0
votes
1 answer

Understanding Tracked Query

I don't understand how tracked queries work. Here there is a piece of my application: GRAPHQL type Admin implements Node { id: ID! program(slug: String!): Program } type Program implements Node { id: ID! slug: String! assessmentLink:…
0
votes
1 answer

Passing arguments to top level fields from within a Relay container

Assume I have a field called country defined at the top level of my GraphQL schema. I can query it in the following way: query { country(alpha2: "gb") { name } } In my relay container I can specify the attributes that I would like returned…
Peter Horne
  • 4,588
  • 5
  • 30
  • 48
0
votes
2 answers

Get data also outside of React components from Relay.js store

I have use case where I want to use some data from Relay store outside of the react components. So thinking how to get data to some store. One option would be to put these data to the 'store' in component once component gets the data. But I would…
Jarda
  • 708
  • 1
  • 5
  • 12
0
votes
1 answer

how to pass value to the root query in react-router-relay

Suppose that I have the following root query in a relay with react-router-relay project: export default { calc: () => Relay.QL`query queryType ($number: String) { auth (number: $number) }`, } Initial value of $number comes from server like a…
msin
  • 13
  • 1
  • 4
0
votes
1 answer

Simple storage for relay starter kit

I'm learning Relay and GraphQL with the Relay starter kit from Facebook. I want to create a simple storage for my data, basically just to keep my GraphQL mutations somewhere. I will deal with a proper ORM and database later. Could I just dump the…
0
votes
0 answers

Understanding fat queries and tree structures

I still have some troubles understanding the concept of fat queries in Relay, especially about the part of the intersection logic to determine which data to re-fetch. Up to now, I have build a simple hierarchical data structure with a UserType as…
tux21b
  • 75,045
  • 15
  • 108
  • 99
0
votes
3 answers

How do you move from stock Relay to Relay with a router?

I have a React/Relay app that is currently working that I would like to add routing to using react-router-relay. When I try the minimum possible conversion, see the code below, I get an incomprehensible error in the log: "Uncaught Error: Invariant…
OverclockedTim
  • 1,673
  • 1
  • 12
  • 22
1 2 3
45
46