Relay: Fetch For Recursive Data Returns Null

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

human {
  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. Clicking on each number open children under it. After 3 or 4 level it starts showing Found children as null. For me it happens on If it doesn't happens so for you then try adding more levels in SCHEMA code and the bug would pop in.

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

Any help is very much welcome.



This was a bug. Given a plural field, when the time came to make a query for new data, we would diff what we have in the store with what the application wants. The bug was that we would assume that all records of a plural field have the same shape in the store, and only use the first store record in any plural field against which to diff. This was of course not true in your case, where some records in a plural field might be expanded and some might be collapsed.

This has been fixed as part of and will be released in the version after Relay 0.9.1.