Questions tagged [relaymodern]
145 questions
1
vote
0 answers
Can't update the store via a subscription because ConnectionHandler.getConnection always returns undefined
I I'm desperately trying to access the connection to update the store through a subscription. I try to follow the v11 doc of Relay to update Connections. I also specify that I followed the specifications of the relay to mount the server.
Here is my…

Clément MARTZLOFF
- 342
- 2
- 9
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
0 answers
How to reduce duplication in relay fragments
I have components that are almost identical but target different graphql entities, im trying to figure out if there's a way I can reduce the duplication of code. For example I have these two fragments:
const PROCESS_REQUEST_MUTATION_A = graphql`
…

Batman
- 5,563
- 18
- 79
- 155
1
vote
1 answer
Disable relayjs garbage collection
Is there a way to disable the relayjs garbage collection (version 5.0.0 or 6.0.0)?
We are still using relayjs classic and it caches all data in a session. This makes loading previous pages fast while fetching new data. In relayjs 5.0.0 they have a…

Danny Larsen
- 150
- 9
1
vote
1 answer
testing react component with 'relay-test-utils'
I am created some components with React with Relay/NextJs, I read the documentation for applied tests: https://relay.dev/docs/en/testing-relay-components, I have been tried to create the test for Fragment Container Tests, with the Mock Payload…

Juan Carlos Cuy
- 11
- 2
1
vote
1 answer
How to best access data from QueryRenderer in a parent component in Relay Modern?
As you can see from the picture below, I'm rendering the popover using a react-relay QueryRenderer since the request is slow, and I do not want the rest of the page to wait for events to be fetched.
My problem is that in the navigation I have a…

Dac0d3r
- 2,176
- 6
- 40
- 76
1
vote
1 answer
how to optimisticResponse a connection property in relay modern mutation?
i have a comments connection in a mutation, this is the query:
export default mutationFromQuery(graphql`
mutation AddBookMutation($input: AddBookInput! $count: Int $cursor: String ) {
addBook(input: $input) {
book {
…

gpbaculio
- 5,693
- 13
- 60
- 102
1
vote
0 answers
How do I make Relay requests include a cookie?
I've got a Relay setup from howtographql tutorial:
const network = Network.create((operation, variables) => {
// 4
return fetch(GRAPHQL_URL, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type':…

A. Karnaval
- 727
- 2
- 8
- 12
1
vote
2 answers
relay-compiler unable to extract and use graphql queries in Typescript
I tried using relay with the Typescript react starter, and am running into multiple issues.
Seems like babel-plugin-relay is not able to sense the graphql statements extracted by the relay-compiler. Here is my compiler script
"relay":…

Giridhar Karnik
- 2,213
- 4
- 27
- 47
1
vote
1 answer
How to do testing with Relay modern with jest and enzyme?
How to test this kind of file with jest and enzyme...
class App extends React.Component{
constructor(){
super()
}
render(){
const { viewer, children, isLoading } = this.props
return(
…

Mayank Pandav
- 425
- 5
- 20
1
vote
0 answers
Best way to use QueryRenderer in Relay Modern
I recently started grokking Relay Modern. I understand that QueryRenderer is used to fetch data using GraphQL query, your root component will have query renderer and all the child components define the data they need in terms of GraphQL…

Pavan Bahuguni
- 1,947
- 1
- 15
- 21
1
vote
1 answer
Issue while updating store from updater function of commitMutation
I have a mutation
mutation createQuoteLineMutation {
createQuoteLine {
quoteLine {
name
price
product {
name
}
}
}
}
My updater function is as below.
updater: (store) => {
const…

Pavan Bahuguni
- 1,947
- 1
- 15
- 21
1
vote
0 answers
Passing Enum as variable to Relay Qraphql query
subscription userSubscription($filter: UserSubscriptionFilter!) {
User(filter: $filter) {
mutation
node {
name
addresses {
id
pincode
}
}
}}
in this subscription query…

Ankit Gupta
- 21
- 4
1
vote
0 answers
React Modern - filter PaginationContainer
I have a list of items which I fetch from a database using Relay's PaginationContainer. I have a loadMore method which works well and is fetching additional results to the existing list of displayed items.
Now I'm struggling with filtering the…

Pawel
- 3,558
- 1
- 25
- 24