gatsby-source-sanity
gatsby-source-sanity copied to clipboard
References are not resolved correctly in `7.4.2`
After upgrading to gatsby-source-sanity to 7.4.2 references are not resolved correctly anymore. We have a BlockContent that accepts the following schema type:
name: 'pageLinks',
title: 'Page Links',
type: 'object',
fields: [
{
name: 'pages',
title: 'Pages',
type: 'array',
of: [{ type: 'documentReference' }],
},
]
...
Where documentReference contains a reference to some document types:
name: 'documentReference',
type: 'object',
fields: [
{
name: 'reference',
type: 'reference',
title: 'Document',
to: [{ type: 'division' }, { type: 'page' }],
},
...
The problem is that querying for _rawBody(resolveReferences: {maxDepth: 10}) does not resolve all fields that used to be resolved. For example the referenced document will not include internal.type. After downgrading to 7.3.2 everything works fine again and internal.type contains SanityPage or SanityDivision as expected.
Any update?
The internal data on nodes gets deleted as of Pull Request #147, might be the root cause of this.
Folks with resolveReferences issues... be sure to run gatsby clean to clear your cache! https://github.com/sanity-io/gatsby-source-sanity/issues/152
I was convinced references weren't working in my PortableText blocks nested in an array field.
Folks with resolveReferences issues... be sure to run
gatsby cleanto clear your cache! #152I was convinced references weren't working in my PortableText blocks nested in an array field.
Not really a solution as it causes longer build times and unnecessary usage of external API's etc.