apostrophe-pages data object returns an empty array under the "_children" key, even after configuration
See original GitHub issueCurrently running version ^2.91.0 of Apostrophe in my project running on Node 12.1.0. I’m using Apostrophe as my headless backend, feeding data to my separate front end application. I am trying to access the children of apostrophe-pages to appear in my data object, however the _children array always returns as an empty array. My pages have 4 levels of child pages and they are all set up in the front end. I specifically need to access the time stamp of “CreatedAt” and “UpdatedAt” of all the children which is why fetching data from “api/v1/apostrophe-pages?all=true&hideOrphans=true” does not suffice as it only returns limited information. Fetching every child via their _id does not seem like the most viable option when fetching volumes deep. If there is a way to access all the children from their top parent level, that would be the most optimal in this case.
My index.js for the lib/modules/apostrophe-pages module contains the following:
addFields: [ { name: '_pages', type: 'joinByArray', withType: 'apostrophe-page', label: 'Pages', idsField: 'pageIds', filters: { children: { depth: 4, areas: false }, projection: { title: 4, slug: 4, rank: 4, level: 4, path: 4 } } } ]
I even tried passing ‘1’ as it says to do in the docs and still only returns an empty array under the “_children” key when logging out data.
and I have the following in my app.js file:
'apostrophe-pages': { filters: { ancestors: { children: { depth: 4 } }, children: { depth: 4 } },
No matter what I try, I still get “_children: [ ]” back from my logs. How can I get the _children key to populate accurately as my navigation tree shows?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top GitHub Comments
Still looking for a simple test project with steps to reproduce it.
Any updates regarding this issue?