Relay is a JavaScript framework for building data-driven React applications.
Questions tagged [react-relay]
91 questions
2
votes
2 answers
Component not rendering when testing with react-relay
I'm trying to test a component using React Relay and React Testing Library
// @flow
import { Suspense } from 'react';
import {
RelayEnvironmentProvider,
useLazyLoadQuery,
graphql,
} from 'react-relay/hooks';
import { createMockEnvironment,…

Batman
- 5,563
- 18
- 79
- 155
2
votes
0 answers
Relay: How to use emitted types when receiving error -> Type '"%future added value"' is not assignable to type
Current project for this question is using react, react-relay, and typescript. When trying to reuse a type emitted by Relay for an enum, an error occurs:
Type '"%future added value"' is not assignable to type
I did a little research and found that…

Kraken
- 5,043
- 3
- 25
- 46
2
votes
0 answers
babel-relay-plugin with react-native (expo) throwing error about 'cypto'
I am trying to implement react-relay in an expo project using the babel-plugin-relay package.
It was working on expo web (npm run web), but when I went to run it on my android device (npm start) this error happened.
The Error
The package at…

Joey Gough
- 2,753
- 2
- 21
- 42
2
votes
0 answers
Relay cache and pagination causes error RelayConnectionHandler: Unexpected after cursor
Description
I have a container that has nested pagination on a file system. I recently added a caching layer to my relay environment to reduce the number of requests we are making. Opening a folder triggers a queryRender, that query fetches 8 edges…

Calum Butler
- 21
- 1
2
votes
0 answers
Uncaught Error: No data returned for operation ``, got error(s)
I am using React-Relay. I am doing a mutation which returns errors which is totally fine but at the end I am getting following error in console which is related to react-relay library.
Uncaught Error: No data returned for operation…

waqas
- 4,357
- 3
- 34
- 42
2
votes
1 answer
AddMutation using relay modern graphql
I'm trying to add a user using relay , below is my schema file
schema.graphql
createUser(input: CreateUserInput!): UserPayload
input CreateUserInput {
clientMutationId: String
data: CreateUserData!
}
type CreateUserData {
firstName:…

Beckham_Vinoth
- 701
- 2
- 13
- 39
2
votes
1 answer
Handling local data in Relay Modern
I'm stuck with passing data returned from a mutation to handle form validation in Reactjs. This pattern is not limited to only form validation but to other components which share similar requirements where something is mutated/queried and the…

Ante Gulin
- 2,022
- 2
- 15
- 16
2
votes
2 answers
React relay injectNetworkLayer is not a function
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…

WB Lee
- 641
- 1
- 6
- 10
2
votes
0 answers
How to compose react-navigation with relay classic
I want to use react-navigation with relay in my project.
The thing I did was:
And the navigator has screens of my app.
Say in MyApp (which is relay container) I query…

FrankenStein
- 369
- 2
- 15
2
votes
1 answer
How to invalidate Relay's cache after mutation
I'm rebuilding a small, internal web app with React/Relay/GraphQL to get familiar with this stack. Basically, it monitors analytics of a list of "active" videos. The only mutation is to replace the list of active video IDs with a new list. The…

donut
- 9,427
- 5
- 36
- 53
1
vote
1 answer
What's the difference between usePreloadedQuery and useQueryLoader?
I'm learning graphQL and react-relay library.
In these 2 sections:
Rendering Queries: introduce usePreloadedQuery.
Fetching Queries for Render: introduce useQueryLoader.
For short, I will say 1st-query instead of usePreloadedQuery, 2nd-query for…

linrongbin
- 2,967
- 6
- 31
- 59
1
vote
1 answer
How to define default mock data for relay?
I am doing unit tests on a react app that is using relay as a graphql client
when testing , i get mocked data with like this :
title: '',
How can i define default mock data ?

Khalfoun Mohamed El Mehdi
- 314
- 1
- 12
1
vote
0 answers
How should I clear the Relay JS store when logging out?
I'm using react-relay v12.
When logging out, should I create a new relay environment (rather than e.g. clearing the store somehow)? I have been doing just that, but I'm now having problems because the Relay environment in the…

MDalt
- 1,681
- 2
- 24
- 46
1
vote
0 answers
How to update connections/edges when adding or deleting edges in a bigger app?
How do you update your connections/edges when adding or deleting edges in an app?
TL;DR: Should I
know all fragments and connections in the app, and handle them whenever I do these mutations?
break my app into multiple context (i.e. pages), and…
1
vote
0 answers
Types of property 'response' are incompatible. Type 'unknown' is not assignable to type 'X'
I am trying to use the useQueryLoader and usePreloadedQuery hooks from react-relay along with typescript and I am getting the following error. The error is specific to Typescript because when I change the file type to jsx the code works as…

avocado
- 79
- 9