-
Notifications
You must be signed in to change notification settings - Fork 10
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
Components with createFragmentContainer not resolving fields #16
Comments
+1 @HsuTing this also means that refetchContainer and paginationContainer don't work when following your next.js example. I'm just trying to render a simple blog page:
but on both the server and client i'm getting the the warning:
and the props:
Any ideas on how to deal with this? |
To follow on from that, if I just do the query without the fragment it works fine:
|
@juhaelee i just worked out the issue. You need to wrap your fragmentContainer in a higher order component which passes in the props as the expected fragment. its not an issue with the library. Please see how I achieved this below:
|
FWIW this may only be required when following https://github.com/zeit/next.js/tree/master/examples/with-react-relay-network-modern |
@stan-sack You should modify the Maybe you can try this: // _app.js
...
return (
<QueryRenderer
environment={environment}
query={Component.query}
variables={variables}
render={({ error, props }) => {
if (error) return <div>{error.message}</div>
else if (props) return <Component pages={props} />
return <div>Loading</div>
}}
/>
);
... |
@juhaelee Is the problem resolved? Maybe you can give the reproduce repo? |
Was actually stuck on this for quite some time, and the above explanation didn't really help. Found this StackOverflow article which describes the same problem and reasoning why it returns a weird payload instead of the data. https://stackoverflow.com/questions/52145389/relay-queryrenderer-does-not-return-expected-props-from-query
Basically, if you pass that reference to a child which has a |
When I have a component with a
createFragmentContainer
HoC, on the server side I get passed props to that component that look similar to this:When I want the props to look something like this (which is what the client gets):
I'm following this example: https://github.com/zeit/next.js/tree/master/examples/with-react-relay-network-modern, with one change in
_app.js
: I'm getting the queryID in the render function byComponent.query().default.params.name
instead ofComponent.query().params.name
. Here are my dependencies:My theory is that when rendered on the server side,
createFragmentContainer
tries to render the component with the exact props it was passed with that contains all the relay metadata, instead of the data that the fragment defines.The text was updated successfully, but these errors were encountered: