Relay is a JavaScript framework for building data-driven React applications.
Questions tagged [react-relay]
91 questions
7
votes
1 answer
fragment cannot be spread here as objects of type "Query"
Trying out relay with react and ran into this today. Here is what I've done so far.
Root Query:
query {
tasks {
id
taskName
taskStatus
userId
}
}
React component hierarchy
App
↳--TaskList (props: tasks)
↳--TaskListItem…

Giridhar Karnik
- 2,213
- 4
- 27
- 47
6
votes
1 answer
How to subscribe to progress event of relay/ graphql mutation
I want to use mutations to upload files too, but I can't find any way to track the progress of the mutation (its upload, similar to the XMLHttpRequest progress event). Afaik relay is using fetch, but fetch doesn't provide any way to track progress…

gucki
- 4,582
- 7
- 44
- 56
5
votes
1 answer
How do I use react router with relay?
I am struggling with react-router and relay integration.
As of now, I stick to this example
It uses the useLazyLoadQuery hook, and although everything seems to work just fine, I also see another way of doing this: usePreloadedQuery.
The docs say…

Alex Tarasenko
- 719
- 6
- 9
5
votes
2 answers
Graphene-Django: In schema combine Query-objects (only takes first argument)
I am trying to combine multiple Query schemas located in different apps in Django 2.1. Using graphene-django 2.2 (have tried 2.1 with same problem). Python 3.7.
The Query class only registers the first variable. As an example…

Espen Finnesand
- 475
- 7
- 22
5
votes
0 answers
Relay modern caching example
I would like to enable caching in my react native application. I am using GraphQL with Relay modern. I found out that caching is not enabled by default in relay modern, but they have exposed RelayQueryResponseCache from relay-runtime, which we can…

parohy
- 2,070
- 2
- 22
- 38
4
votes
1 answer
react-relay Invalid use of @refetchable on fragment
I am learning react-relay (v13) and have a problem specifying a pagination fragment with @refetchable. It is a very basic structure and everything works if @refetchable is not used (ie I can query grapql server, obtain data, useFragment to render…

user9128309
- 165
- 11
4
votes
1 answer
How performance will impact with react relay if we use loadQuery and usePreloadedQuery vs loadQuery and useLazyLoadQuery hook?
loadQuery and usePreloadedQuery - This combination will actually be performant because we are using reference returned by loadQuery in the usePreloadedQuery hook so this follows the "render-as-you-fetch" pattern.
loadQuery and useLazyLoadQuery - If…

akash salunkhe
- 63
- 3
4
votes
2 answers
How to handle CSRF tokens with React Relay
I am busy working on a React Native app which talks to a GraphQL api off a Django server.
In React Native I am using React Relay to try and process my GraphQL requests (following the guide found here) but I am having 403 issues with my…

Simon
- 2,065
- 3
- 21
- 28
4
votes
0 answers
Relay modern: refetch doesn't update props
I'm trying to use createRefetchContainer of the Relay Modern. but the props aren't passed down to my component from the result of the refetch query. The refetch query runs okay and the response will come back from the server, but the ui doesn't get…

Mani Shooshtari
- 760
- 1
- 6
- 19
3
votes
1 answer
How to pass down props without duplicating fragments
I have parent component that ends up with nested fragments looking like this:
query MyAppQuery(
$id
$a
$b
$c
) {
viewer {
...App_viewer
...ComponentA_viewer @include(if: $a)
...ComponentB_viewer @include(if:…

Batman
- 5,563
- 18
- 79
- 155
3
votes
1 answer
How add react-relay component to the storybook?
I am trying create a storybook for my react-realy app, but i don't know how to set mockup data for that component. For simple a component it is ok, because i can use dummy UI component vs Container approach, but i can't use this for nested relay…

Grund
- 309
- 1
- 2
- 12
3
votes
0 answers
relay refetch doesn't show the result
I'm trying to create a live search-result component(lazy load one). It works perfectly for the first time but refetch doesn't update the data. I see the request and respoonse in Network tab! so it does get the data, but it doesn't supply it to the…

Mohsen ZareZardeyni
- 936
- 7
- 17
2
votes
1 answer
Unable to run relay-compiler
I installed the relay for my react-native project following the steps on relay.dev. Running the compiler works fine when I have an empty schema file. Putting schema to the file starts throwing me this error:
thread 'main' panicked at 'Expect…

Abhimanyu Kaushal
- 55
- 5
2
votes
0 answers
Why does watchman gives timeout error when using it with react-relay?
I'm using WSL Ubuntu to run a react-relay project, but after installing watchman using brew and trying to run the app in watch mode, watchman gives me the following error(I have run the project using yarn start):
Watchman error: The watchman server…

Marius
- 37
- 1
- 4
2
votes
0 answers
Suspense in a FlatList
I am developing a React Native app with Relay. I was using a FlatList inside a ScrollView like this:
...
I experienced issues with ondEndReached (it’s being called every…

Luciano Di Pasquale
- 21
- 1