Hi!
I'm using the REST API v2 via prismic-javascript
to fetch my documents. I am using fetchLinks
to fetch a content relationship field's document data to create a URL in my link resolver.
When I log the value of doc
in my link resolver for a document with a parent, I receive the following payload. The content relationship field is named parent
.
{
id: 'DOC_ID_CHILD',
type: 'page',
tags: [],
slug: 'business-savings',
lang: 'en-us',
uid: 'business-savings',
data: {
parent: {
type: 'Link.document',
value: {
document: {
id: 'DOC_ID_PARENT',
type: 'page',
lang: 'en-us',
tags: [],
slug: 'business-banking',
uid: 'business-savings'
}
},
isBroken: false
}
},
link_type: 'Document',
isBroken: false
}
I see two possibly related problems with the payload:
-
There seems to be a mixture of GraphQL and non-GraphQL style link payloads. One uses
link_type: Document
while the other usestype: 'Link.document'
. I don't believe this repo has GraphQL enabled as it was created in 2018. -
slug
anduid
in the parent document are out of sync and incorrect.
UID - It's providing the UID of the child document, not the parent document.
- Expected:
business-banking
- Actual:
business-savings
Slug - This is correct, but slug has been known to be out of sync/outdated.
- Expected:
business-banking
- Actual:
business-banking
I'm aware slug is deprecated, but it currently is the only way I am able to get the correct UID. This causes issues in other parts of the site where the slug is incorrect.
Any ideas? I can provide more detailed, specific information in a private chat if necessary.