contentful-management.js
contentful-management.js copied to clipboard
The `include` query option doesn't work
Here is my code:
const s = await client.getSpace('**********')
const e = await s.getEnvironment('master')
const i = await e.getEntry('**********', { include: 10 })
console.log(i)
Here is the schema:
{
...
"fields": [
{
"id": "children",
"name": "Children",
"type": "Array",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false,
"items": {
"type": "Link",
"validations": [
{
"linkContentType": [
"copyCopyRow",
"articleImageRow",
"articlePullQuote"
]
}
],
"linkType": "Entry"
}
}
]
...
}
When I query an entry, I expect to have the information for all of the entries inside the children
field, but here is what is actually returned:
{
...
"fields": {
"children": {
"en-US": [
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "************************"
}
},
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "************************"
}
},
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "************************"
}
},
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "************************"
}
}
]
}
}
...
}
Version: ^10.34.1
Also seeing this issue. The response should either contain resolved entries or an Includes
section where linked entries can be resolved.
I think the wrapCollection
utility just pulls out the items
collection from the response.
Is this related to being able to subsequently update entries with linked items?
@AliRezaBeitari FYI, I found the [Entry].references
method and this fetches all of an entry's linked references.
I'm not certain, but I assume that as the entry may need to be updated at a later time, its linked entries are not included.
The includes
data is returned in the original request, so it could be included in the original entry (somehow) to avoid having to re-request it. Might be opening a can of worms by doing that, though...
I'm having a similar issue...
await environment.getEntries({ 'content_type': 'siteMenu', "fields.name": "Primary Menu", include: 10, })
"include" on contentful-management doesnt work
however, in contentful lib it works as intended
I am still facing this issue 6 months later 😢