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
10
votes
1 answer

RelayContainer: Expected prop `%s` to be supplied to `%s`, but ' + 'got `undefined`. Pass an explicit `null` if this is intentional

I try to Implement some stuff with React, Relay and GraphQL, but I faced a Problem I dont understand and where i cant find a solution. First I created a RootQuery and had one Component and it worked well. Now I created a Sub Component with an own…
Ronny Gerndt
  • 181
  • 1
  • 7
10
votes
1 answer

React Relay Error 'Object has no method find'

I've been working with reactjs a fair bit and thought I'd start playing around with graphql and relay. I've hit an error that I can't get to the bottom of, so I wondered if anyone on here may have encountered the same. Any pointers or ideas would be…
Kraken18
  • 623
  • 2
  • 11
  • 24
10
votes
1 answer

Purpose of @relay(pattern:true)

New expression @relay(pattern: true) was introduced in change log for relay.js 0.5. But can't figure out from description nor tests what exactly it does and when I should use it when writing fatQueries. Some example would be very helpful.
Jarda
  • 708
  • 1
  • 5
  • 12
10
votes
2 answers

How do i create a graphql schema for a self referencing data hierarchy?

This doesnt work because the type refers to its self in the routes field definition: var routeType = new GraphQLObjectType({ name: 'MessageRoute', fields: { name: { type: GraphQLString }, routes: { type: new…
SammoSampson
  • 215
  • 3
  • 8
10
votes
1 answer

How to get the ID of a new object from a mutation?

I have a createObject mutation that returns the ID of the new object. After it returns I want to redirect to a detail page about the new object. How can I get response fields from a mutation in the containing component using react/relay? E.g. my…
jbrown
  • 5,873
  • 9
  • 56
  • 101
9
votes
0 answers

How to trigger GraphQL Subscriptions from a backend message queue application

Currently I'm using Socket.io / SignalR to emit an event from my backend message queue system, whenever new data is incoming. That way I can setup an event handler in my React application and update the relay cache from within the event handler. It…
Dac0d3r
  • 1,761
  • 3
  • 33
  • 57
9
votes
2 answers

Handling authentication in Relay Modern

I am using token-based authentication and wonder how to fully tie it together in Relay Modern. I am halfway through. Any help is much appreciated. This is the setup I have: At the top level inside I render the entry…
soosap
  • 1,027
  • 1
  • 10
  • 28
9
votes
2 answers

Not able to get Relay work with React Native

I'm trying to setup a basic React Native Relay project. I'm creating this issue after spending ample of time trying debug the problem without any luck. I'm getting this warning on console and my react native app is not able to make calls to GraphQL…
Bilal Budhani
  • 497
  • 2
  • 13
9
votes
2 answers

search functionality using relay

How to implement a search functionality with relay? So, the workflow is user navigate to search form. there should not be any query (as in relay container) when initializing the view. user fills the field values, and press the action/search…
bsr
  • 52,180
  • 78
  • 198
  • 296
9
votes
3 answers

How to pass total count to the client in pageInfo

I use first after and last before to do pagination. hasNextPage and hasPreviousPage are very useful. But what I need is also the total count so that I can calculate and show things like page 5 of 343 pages on the client. Unfortunately that is not…
Christine
  • 2,998
  • 1
  • 18
  • 33
9
votes
1 answer

Relayjs Graphql user authentication

Is it possible to authenticate users with different roles solely trough a graphql server in combination with relay & react? I looked around, and couldn't find much info about this topic. In my current setup, the login features with different roles,…
Seneca
  • 2,364
  • 2
  • 16
  • 29
8
votes
2 answers

Relay/GraphQL Schema cache not updating when I update schema on server side

I have a React app using Relay and a remote GraphQL server. When I start the webpack server, I have it fetch the latest schema and feed it into the babel-relay-plugin. It works great....except when I make a schema change. It appears React or Relay…
postalservice14
  • 2,323
  • 4
  • 23
  • 33
8
votes
1 answer

Attempted to add an ID already in GraphQLSegment

My Relay/GraphQL fragment contains two different queries, both of which return objects of the same type, and there is often some overlap between the result sets returned by either (and that's perfectly fine with me). I see the following warnings in…
sk29910
  • 2,008
  • 1
  • 16
  • 20
8
votes
1 answer

Generate schema.json with GraphiQL or GraphQL endpoint

I'm having issues creating a schema.json file that can be parsed with babel-relay-plugin without running into an error. Taking a look at the schema.json file included in relay's example folder, I tried to copy the query in GraphiQL but I can't seem…
csm232s
  • 1,614
  • 3
  • 30
  • 54
8
votes
1 answer

In a GraphQL/Relay mutation that creates a model, is there a way to get back the model ID?

We're using Relay and GraphQL in a new project. We've got a Relay mutation that creates a new model in the DB: export default class AddCampaignMutation extends Relay.Mutation { getMutation() { return Relay.QL`mutation { addCampaign }`; …
colllin
  • 8,586
  • 9
  • 44
  • 61
1 2
3
45 46