-
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
Diagnosing failure after upgrading to v0.8.0 #76
Comments
You're not getting an error or anything? |
Nothing :/ |
Try setting e.g. a breakpoint in |
How can I verify that? It looks like it's getting a I've got a breakpoint in this function:
And
|
Check the array of components. Also, what does the React devtool show as actually being rendered? |
Also having problems after upgrading to 0.8 :( There is nothing in the console and React devtools renders 'null' inside StaticContainer. |
Try setting a breakpoint in |
@taion The React devtool shows this: It shows the CampaignList component when it should be Campaign. Trying to find the array of components and getData now... |
New information: I was initially upgrading from:
to:
As an experiment, I tried upgrading to an intermediate step:
And I found the same bug there. Since I don't see any code changes between v0.6.2 and v0.7.0, it must be a bug in react-relay, right? |
Ok, I was able to get it working with Unfortunately, I'm still stuck on getting |
Do you have a runnable example? |
I made one. It seems to be related to switching queries between routes: |
I tried out your code, it seems that https://github.com/relay-tools/react-router-relay/blob/master/src/RouteAggregator.js#L58 |
Yup, per @Agrosis, you have the wrong signature for campaign: () => Relay.QL`
query {
campaign(id: $campaignId)
}
`, or campaign: (Component, params) => Relay.QL`
query {
campaign(id: $campaignId) {
${Component.getFragment('campaign', params)}
}
}
`, I had been doing something incorrect with ignoring the signature of the query function. It's not correct to specify a query function with arguments if you're not going to manually compose in the fragment. |
Totally fixed it. Thanks for your help @taion and @Agrosis . How do you feel about adding an error so that other people who make the same mistake have an easier time figuring it out? I can implement if you can direct. Also, how/where did you learn this?
|
I can't - or rather it doesn't really make sense at that level for me to introspect into your query to figure out what it's doing. I'm giving you exactly what you'd get if you passed this query directly into upstream Relay, where it would also break in a similar way. This is really just the syntax for writing Relay queries - you probably don't want to use the old syntax any more, but it used to be the only syntax before @devknoll added the shorthand. |
Yeah, I don't think it was specifically mentioned anywhere, but it's been the documented way since relay@0.2.1. I think since that so closely followed release, it wasn't expected to affect a large number of people. It looks like facebook/relay@658587e is relaxing the restriction here, which may make this even more confusing 😉 |
So for reference, this is the query: campaign: (campaignId) => Relay.QL`
query {
campaign(id: $campaignId)
}
`, I don't believe this is valid under any version of Relay. Previously we were being sloppy and just dropped all of the arguments entirely, which led to #72 and facebook/relay#585, which I fixed in c1092ed. |
Got it. |
Hey, How can I diagnose a silent failure after upgrading both react-router-relay and react-router?
I was already on react-router@1.0.0-rc3, but upgraded to Relay@0.5.0, react-router-relay@0.8.0, and react-router@1.0.0.
I switched to using
<RelayRouter>
, but now one of my routes doesn't correctly render its children.I have something like...
And CampaignList renders correctly at the root (
/
), but at/campaigns/:id
, Campaign doesn't render. My best guess is that it has something to do with having deeper nesting? Since CampaignList doesn't have any child routes but Campaign does.The text was updated successfully, but these errors were encountered: