I've got the following paths defined on my router:
getProjectById[{keys:ids}][{keys:props}]
projects[{ranges:ranges}][{keys:props}]
On client I'm able to successfully retrieve individual projects with the following query:
model.get(
['getProjectById', 'ffd38a56-cca2-11e5-9e6a-695c9890612f', 'name'],
['getProjectById', 'ffd38a55-cca2-11e5-9e6a-695c9890612f', 'name']).then((data) => {
console.log('valid json response ->', data);
});
The 'projects' route returns a reference to each individual project, yet when I make the following request I get undefined as my response:
model.get(['projects', { from: 0, to: 2}, ['name', 'overview']]).then((data) => {
console.log('response is undefined ->', data);
});
The server endpoint returns a promise, when that finally resolves it contains the following array of paths:
[
{ path: ['projects', 0], value: { $ref(['getProjectById', 'ffd38a56-cca2-11e5-9e6a-695c9890612f'] }},
{ path: ['projects', 1], value: { $ref(['getProjectById', 'ffd38a55-cca2-11e5-9e6a-695c9890612f'] }},
{ path: ['projects', 2 ], value : { $atom(undefined) }
]
According to the docs, this should perform a secondary hit on 'getProjectById' route passing in the array of identifiers, but this never gets triggered.
I had similar problem, maybe it will help.
I will give an example, how I've solved it in the past:
First route, that contains the $ref (not working):
FIX:Delete the ["title"] from the articles route, so the new working is code:
As you can see I've deleted the ["title"] above... you must also make sure that in the articlesById, you have this "title" in place when returning the data so: