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)

737 questions
10
votes
1 answer

Pass variables to fragment container in relay modern

I'm using Relay Modern (compat). I have a fragment that contains a field that has one argument, but I can't find a way of passing the variable value from the parent component: // MyFragmentComponent.jsx class MyFragmentComponent extends Component…
Maikel Ruiz
  • 1,342
  • 2
  • 15
  • 25
10
votes
1 answer

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,365
  • 2
  • 14
  • 30
10
votes
2 answers

React Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `App`

I'm getting that error, but I'm defining a key. Here's my App.js that it's complaining about. import React from 'react'; import Relay from 'react-relay'; import AccountTable from './AccountTable'; class App extends React.Component { render() { …
LoneWolfPR
  • 3,978
  • 12
  • 48
  • 84
10
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,326
  • 1
  • 18
  • 23
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
  • 663
  • 2
  • 11
  • 25
10
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
  • 57,282
  • 86
  • 216
  • 316
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
  • 1,188
  • 1
  • 7
  • 12
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
  • 7,518
  • 16
  • 69
  • 117
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
  • 487
  • 3
  • 13
9
votes
2 answers

How to manage cursors and sorting in Relay?

We have a graphql server (not written in javascript) serving a paginated list of objects. We're trying to conform to the relay specification, but we've hit an interesting case that could use clarification. Specifically: are cursors allowed to depend…
Evan
  • 6,369
  • 1
  • 29
  • 30
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
  • 3,014
  • 2
  • 24
  • 34
9
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,660
  • 4
  • 32
  • 60
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,392
  • 2
  • 18
  • 33
8
votes
0 answers

Custom scalar in schema mapped to type

I'm following the example of getting started using relay with typescript(https://relay.dev/docs/en/quick-start-guide) and it inititlly works as expected. I am trying to modify my schema to include some custom scalars, so my schema looks something…
crafty
  • 10,346
  • 1
  • 18
  • 15
1 2
3
49 50