Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

References are not resolved correctly in 7.4.2 #154

Open
marijoo opened this issue May 6, 2022 · 4 comments
Open

References are not resolved correctly in 7.4.2 #154

marijoo opened this issue May 6, 2022 · 4 comments

Comments

@marijoo
Copy link

marijoo commented May 6, 2022

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.

@zanedev
Copy link

zanedev commented Jun 29, 2022

Any update?

@raae
Copy link

raae commented Jun 29, 2022

The internal data on nodes gets deleted as of Pull Request #147, might be the root cause of this.

@doublejosh
Copy link

doublejosh commented Mar 22, 2023

Folks with resolveReferences issues... be sure to run gatsby clean to clear your cache! #152

I was convinced references weren't working in my PortableText blocks nested in an array field.

@intelligence
Copy link

Folks with resolveReferences issues... be sure to run gatsby clean to clear your cache! #152

I 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants