Problem
When resolving an ember model object graph, objects that contain relationships that itself contain relationships with the same name do not get resolved.
Example:
+-- industry
+-- id
+-- title
+-- details
+-- geographies
| +-- id
| +-- name
| +-- code
+-- companies
| +-- id
| +-- name
+-- subIndustries
+-- id
+-- title
+-- details
+-- geographies (missing)
| +-- id
| +-- name
| +-- code
+-- companies (missing)
+-- id
+-- name
Given the industry object graph above, an industry's relationships (geographies, companies) are missing from the response of an industry's graphql query.
Root problem
The ember-graphql-adapter
keeps track of visited
relationships by the relationship name. If it encounters the same relationship name again, it will not walk down that path when parsing and building the ember object graph. This results in a generated graphql query with child relationships missing relationships.
Solution
Extend the options of the ember model definition with resolveAlways
. When the parser encounters this option, it will traverse this relationship even if it has already been visited
.