Skip to content
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

Relay fetch for recursive data without ids returns null #742

Closed
shahankit opened this issue Jan 13, 2016 · 7 comments
Closed

Relay fetch for recursive data without ids returns null #742

shahankit opened this issue Jan 13, 2016 · 7 comments

Comments

@shahankit
Copy link

I have a recursive data structure to be fetched and displayed. I have a graph ql type as follow:

human {
  name,
  children: [human]
}

Now I wanted to incrementally fetch data and hence used to react classes HumanList and HumanItem, where I've used relay to fetch children only when a item is clicked. In my actual code relay gives children a null on very click i.e. on rendering very first set of children. I tried test code on relay playground and found similar issue. Here is the link to gist. Playground.js contains the code part and Playground.gql.js contains schema part.

I've already checked #246 and #536 but none of them helped.

@josephsavona
Copy link
Contributor

Thanks for your question!

We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of Relay.

Questions like yours deserve a purpose-built Q&A forum. Would you like to post this question to Stack Overflow with the tag #relayjs? We'll be happy to answer there. Post a link to your Stack Overflow question here, to so that we don't lose track of it.

https://stackoverflow.com/questions/ask?tags=relayjs

@shahankit
Copy link
Author

I created a stackoverflow for same here. Any insights to issue are greatly welcome or temporary work around for issue if possible.

@josephsavona
Copy link
Contributor

Thanks! Let's move discussion to the SO question.

@shahankit
Copy link
Author

@josephsavona This is actually a bug, so can you please reopen the issue.

@josephsavona josephsavona changed the title Relay fetch for recursive data returns null Relay fetch for recursive data with ids returns null Jan 21, 2016
@josephsavona josephsavona changed the title Relay fetch for recursive data with ids returns null Relay fetch for recursive data without ids returns null Jan 21, 2016
@josephsavona josephsavona reopened this Jan 21, 2016
@josephsavona
Copy link
Contributor

@shahankit just saw your SO comment - yeah this looks like a bug. I suspect this has to do with the fact that the schema doesn't use the Node interface, which means calls to fetch recursive data can't use node(id: $id) calls. We'll keep this open to track work on a fix, but as a workaround I would suggest implementing Node and see if that helps.

@steveluscher
Copy link
Contributor

You were right all along. This was a bug. Fixed in #1243

@shahankit
Copy link
Author

@steveluscher thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants