-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Compatible with Relay 2 #234
Comments
Thanks for mentioning this. Not quite sure how I want to tackle this yet – I think I want to move over the API entirely. |
|
I wonder if this library will still be necessary at all? The docs seem to imply that |
See discussion on facebook/relay#1628. You can already use |
Thank you @taion. As long as every route corresponds to one container though (with nothing but dumb components) waterfalls shouldn't be a problem, correct? |
If you nest |
Does ReactRouter's bundling not help? https://reacttraining.com/react-router/web/guides/code-splitting |
Yes, if you have code splitting setup waterfall isn't an issue. Relay modern seems to work fine with React Router v4. |
No, that's dangerously wrong. The problem is that if you have nested routes, the naive approach of using a Even if you're not doing any code splitting, this is still a problem. The nested |
Has anyone come up with any architecture or patterns? Im starting to migrate to React Router v4 and Relay Modern but all I can think of right now is to use a single root level |
@taion But if one doesn't nest this shouldn't be a problem right? Say each route correspond to one query renderer without any nesting and have route level async code-splitting. |
@gauravtiwari That's what I'm doing, and it works as expected. But @unirey is right, it's not much of an upgrade. |
I've actually switched to Apollo and haven't head any more headaches since. (It's likely though that Relay Modern has since ironed out a lot of the issues I had.) |
If you want something that will work well with Relay Modern, take a look at Found + Found Relay. I haven't put the code up for Relay Modern integration yet, but I'll probably get something up next week. The only thing I'm looking to accomplish is to allow using the equivalent of nested When I get a chance to check, I'll take a look at merging #235, but I'm not planning on doing further work here outside of maintaining support for Relay Classic in Relay v1. There isn't really any good pattern for using React Router v4 with really any data fetching library without hitting request waterfall problems. If you want to get optimal data fetching performance with anything – Relay, Apollo, plain REST calls – and still colocate your query equivalents with your routes, then you don't want to be using React Router v4. |
@taion is there any short example to get one started with using Relay Modern and Found + Found Relay? |
I don't have the code up yet – will do so soon. It should look pretty similar to what's here, except you'll specify one query instead of a query set. |
Fixed in #237 Not going to support Relay Modern, but this will allow using Relay v1 at least |
Please update the docs to describe that support is restricted to relay classic. |
Good point |
done |
Hi!
Using react-router-relay breaks in react-relay@1.0.1-alpha.2
It can be fixed if
react-relay
is replaced withreact-relay/classic
react-relay@1.0.1-alpha.2
,relay-compiler@1.0.0-alpha.2
,babel-plugin-relay@1.0.1-alpha.2
(babel-plugin-relay
published on npm as of April 15, 2017 won't work, will be explained later)./fixtures/babelRelayPlugin
inreact-router-relay/test/.babelrc
with the following plugin and options[ "relay", { "compat": true, "schema": "./fixtures/schema.graphql" }]
to fix tests.You would have to generate a "schema.graphql" file from the "schema.js". Something like this in the updateSchema.js would work:
I could do a pull request, but I'm not sure how you would want the API to look like to support both Relay 1 and 2.
It is a bit early to start work on this, but it's good to keep in mind. The
babel-plugin-relay
package required to compilereact-relay/classic
is not published on npm yet, but you can download it from the 'facebook/relay' repo right now.The text was updated successfully, but these errors were encountered: