Open adammo94 opened 1 year ago
I think your best choice is to look at the old docs. Eg here: https://github.com/facebook/relay/blob/v1.5.0/docs/Modern-ConversionPlaybook.md
@edvinerikson as I've said, I tried updating according to migration guide, however I do not know if changing from fragments to queries is a good way? Also I do not know how do include fragments that are inside (classic) mutations in (modern) queries/mutations
You probably want the compat api. Eg createFragmentContainer from the compat module. These fragments can be referenced from classic and modern. Regarding mutation you can probably just query all fields that may change, this how it's done in modern. Otherwise I suppose mutation might still be able to reference compat fragments.
https://github.com/facebook/relay/blob/v1.5.0/docs/Modern-RelayCompat.md
The suggested approach in the docs is to:
Don't start at the top of the component tree, start at the bottom/leaf components instead and work yourself up to the query.
The docs also states this which might clear things up regarding your mutation question:
* Modern API doesn't support mutation fragments. You might have to inline the mutation fragments from your legacy mutation in the fragment of the component.
You can run the codemod for the fragments: https://github.com/facebookarchive/relay-codemod/blob/master/transforms/migrate-to-modern-1.0.js
Hey, I'm working on migrating super-duper old project made in relay which apparently has no documentation (0.9.4). Since project is made with class components, I made the decision to move to relay modern without hooks (legacy API). I saw a migration guide, but not everything is clear to me.
here's an example how it is currently working, React-router (v3) route:
ViewerQueries
Login Component
LoginPageContent
How do I put ${SomeComponent.getFragment('someFragment') in relay modern? Currently it says it came across dollar sign and won't process.
What I've done:
the QueryRenderer worked, but I don't know if moving from fragments to whole queries is the right way:
Mutation (before):
Same mutation modified to be compatible with relay-modern. Is this ok?