Questions tagged [react-relay]

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

91 questions
1
vote
1 answer

Access Relay state without passing down props

I'm learning Relay now and I was wondering if there is a way to access the state without having to pass down props. I thought that Relay used React Context, however, in all the examples they seem to be using props to pass down state instead of…
Riley Conrardy
  • 392
  • 1
  • 9
  • 17
1
vote
0 answers

Relay optional query with usePreloadedQuery

Let's say you have this use case: A simple form with one input and a submit button. When the input value is valid (>3 chars) you want to query the server to see if the value is already in use. The button should be disabled when A. input value is <4…
Malo Guertin
  • 307
  • 2
  • 16
1
vote
1 answer

How to Compile React-Relay

I am trying to follow the official Relay documentation here. After installing React-Relay: npm install --save relay-runtime react-relay npm install --save-dev relay-compiler graphql babel-plugin-relay ... and configuring package.json: { ... …
Chong Lip Phang
  • 8,755
  • 5
  • 65
  • 100
1
vote
1 answer

hydrate Relay Fragment without Query

In some parts of my app, I have a component using a fragment. but up the tree somewhere, i sometimes need to create temporary objects waiting to be synced with the server (once they will they are transformed as plain relay objects). But until then,…
eMerzh
  • 485
  • 1
  • 4
  • 12
1
vote
1 answer

Catch errors from usePreloadedQuery

I have this code and I want to catch the errors that happens in the query used by usePaginationFragment. what happens now is when something goes wrong in the backend, the data.queryName returns null, and there is no way to know about the errors. the…
naoufal bardouni
  • 241
  • 3
  • 11
1
vote
1 answer

Property 'then' does not exist on type 'RelayObservable'. when I try to fetch data using relay in react. I don't know why this error come

Property 'then' does not exist on type 'RelayObservable'. when I try to fetch data using a relay in react. try { fetchQuery(environment, expenseQueryMyQuery,{}).then((data)=>{ console.log("All…
1
vote
1 answer

Should I minimise the number of subscriptions in my relay application?

I am new to using graphql and we have built a backend graphql server using elixir and we are building a frontend app using react and react-relay. My question is whether it is better to have one large subscription at the root of my query renderer…
Joey Gough
  • 2,753
  • 2
  • 21
  • 42
1
vote
0 answers

stop relay modern useLazyLoadQuery refetching in a pagination when data is available in cache?

i have this pagination in relay modern: const CategoryContent = () => { const { categoryQuery } = useRoute().params; const { viewer } = useLazyLoadQuery( graphql` query…
gpbaculio
  • 5,693
  • 13
  • 60
  • 102
1
vote
1 answer

QueryRenderer doesn't update after a mutation is committed

I am very new to relay and GraphQL and looking to emulate the behaviour of after adding a mutation, my component updates with the new mutation. For example, when I add an animal, it then shows up on my animal list. I have read a bit about manually…
Charklewis
  • 4,427
  • 4
  • 31
  • 69
1
vote
0 answers

How to use Persisted Queries with React Relay and Apollo Server

My company is currently using React Relay Modern for the client side and Apollo Sever for our GQL server. As of now they are looking at adding a number of optimizations to improved performance. One of the things in my reading of the subject is the…
1
vote
1 answer

Uncomment react-relay flow types

I am using relay-compiler for compile my relay GraphQL queries. I am also using flow for type checking. My IDE does not understand flow comment style type checking. so I want to uncomment them. I need a regex to find these comments and uncomments…
mohsen saremi
  • 685
  • 8
  • 22
1
vote
3 answers

SO Relay QueryRenderer - TypeError: this.props.render is not a function

I have a project in React using Redux and Relay. The client connects to an API Server using GraphQL. I was trying to use the component QueryRenderer and I'm getting the following error: TypeError: this.props.render is not a…
Matías Magni
  • 313
  • 1
  • 4
  • 19
1
vote
2 answers

Relay-Modern FragmentContainer data not populated

I'm using Relay Modern to try to load data into a FragmentContainer. I'm using the familiar Container (Smart) / Presenter (Dumb) pattern and the data is not being passed into my child Container as expected. However, if I use Relay's @relay(mask:…
Bibs
  • 995
  • 1
  • 8
  • 17
1
vote
1 answer

refetchContainer gives same results with or without force in refetchOptions in Relay Modern

In Relay Modern refetchContainer gives same results with refetchOptions: { force: true } and refetchOptions: { force: false }. I have a refetch container like following: export default createRefetchContainer(radium(UserPicker), graphql` fragment…
meteors
  • 1,747
  • 3
  • 20
  • 40
1
vote
1 answer

Variable is not in scope error when relay-compiling Relay Modern code

I have the following simple Relay Modern code: import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { QueryRenderer, graphql } from 'react-relay' import environment from '../../../../../environment' const…
Mendes
  • 17,489
  • 35
  • 150
  • 263