Questions tagged [relaymodern]
145 questions
13
votes
2 answers
Relay Modern RefetchContainer props aren't passed to component
I'm having some issues setting up a refetchContainer in Relay Modern. A parent component is the QueryRenderer, which runs an initial query, populating the child component's props appropriately (a-prop-riately? eh? eh?!) . The refetchContainer…

cntrlz
- 131
- 6
12
votes
3 answers
Where the data is Storing in Graphql
I started to use graphQl with react relay. And I followed some tutorials and I can able to get and post with the help of mutations and queries. Everything works fine but my question here is,
Where qraphql is saving the data and fetching that for…

Beckham_Vinoth
- 701
- 2
- 13
- 39
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
8
votes
0 answers
How to send data from fragment to deep nested component?
I'm working with Relay Modern on Project. But I'm not sure how to send data from a place when I put fragment
to place where Is component placed.
for example:
this is components composition
-Page (QueryRenderer)
---Header
---body
---List
…

Grund
- 309
- 1
- 2
- 12
8
votes
2 answers
relay modern: how to mock relay for unit testing
Am trying to test react relay modern container, but am having this issue.
TypeError: Cannot read property 'environment' of undefined
Here is the test code:
test('render component', () => {
const tree = renderer.create(
,
…

user3462064
- 455
- 2
- 6
- 24
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
7
votes
2 answers
React GraphQL Relay - How to do a simple query?
The Goal:
I'm trying to query a specific character from a GraphQL server with relay.
The Problem:
The query works in GraphiQL. But here, when running "relay-compiler": "^1.4.1" I'm getting...
ERROR: Parse error: Error: FindGraphQLTags: Operation…
user6198643
6
votes
0 answers
Refetch container refetches, but does not update the view
My application looks something like what's included in the snippets below.
(I've left out a lot of the implementation details in the hopes that the code below is sufficient to get my question across).
SampleApp.js
const SampleAppQuery = graphql`
…

Vijay Selvan Ram
- 168
- 2
- 8
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
1 answer
How can I share the same form for creating and updating an object in relay-modern (experimental)?
I am new to relay and I'm attempting to use relay modern experimental in concurrent mode. I have been able to load nodes, edges, etc just fine with Suspense and ErrorBoundary. I'm now working on a form for create and update of an object.
I can't…

Duane
- 273
- 1
- 11
5
votes
1 answer
In Relay.js, what is the `Client Mutation Identifier`?
In the relay documentation here, it says that:
Relay uses a common pattern for mutations, where there are root fields on the mutation type with a single argument, input, and where the input and output both contain a client mutation identifier used…

davidx1
- 3,525
- 9
- 38
- 65
5
votes
0 answers
Missing fields in graphql mutation payload
I'm new in graphql. I need to perform a mutation using Relay Modern in a React app. According to docs mutation payload can be different from success response to error response. Everything goes fine with success response, but with error response I…

MissingTime
- 51
- 2
5
votes
1 answer
Setting up multiple network layers in Relay Modern
I am using a react-native app with relay modern.
Currently our app's fetchQuery implementation, just does a fetch on the network (like in https://facebook.github.io/relay/docs/en/network-layer.html),
Although there is a possibility of another…

jay shah
- 903
- 6
- 21
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
2 answers
React useState giving previous state value always
I am new to React Hooks and trying to build functional component. In my component i have two calendar which user can select date range. As user select date, i need to update my query. I try using useState but my state value is always stole and…

jvm
- 1,662
- 8
- 27
- 46