Giter Site home page Giter Site logo

Comments (12)

chandlervdw avatar chandlervdw commented on July 18, 2024 3

This fixes the unresolved refs issue: #66

from gatsby-source-sanity.

roffelsaurus avatar roffelsaurus commented on July 18, 2024 1

I did more research and an attempt at fixing this today.

  • no references work as expected and gives you a usable portable(despite #37 claiming otherwise)
document {
   object {
      _rawPortable
   }
}
  • top level field portable with refs work
document {
      _rawPortable(resolveReferences: {maxDepth: 10})
}
  • but portable nested in object does not dereference the { _ref } objects
document {
   object {
      _rawPortable(resolveReferences: {maxDepth: 10})
   }
}

I got annoying error like "_rawTitle: incorrect OutputType: JSON"from graphql-compose when using npm link on gatsby-source-sanity into my gatsby project, so couldn't actually debug this properly, but just using DEBUG=sanity gave a clue that
resolveReferences was called for the object with _ref, but it gave the error message here:

debug(`Could not resolve reference to ID "${targetId}"`)

from gatsby-source-sanity.

rexxars avatar rexxars commented on July 18, 2024

Does the referenced document still exist? I see the reference is set to weak.

from gatsby-source-sanity.

intensr avatar intensr commented on July 18, 2024

Hey Espen,
yes I log several items which all are referenced to different documents, but good point.

from gatsby-source-sanity.

intensr avatar intensr commented on July 18, 2024

@rexxars is there any news on this?

from gatsby-source-sanity.

chandlervdw avatar chandlervdw commented on July 18, 2024

I, too, have this issue, though I don't have any _weak attribute within my unique mark attribute object.

image

from gatsby-source-sanity.

intensr avatar intensr commented on July 18, 2024

I investigated a bit further.

Lets say you have those two document types (just for testing purposes)

export default {
  name: 'page',
  title: 'Page',
  type: 'document',
  fields: [
    {
      name: 'link',
      title: 'Link',
      type: 'reference',
    }
  ]
}

and

export default {
  name: 'job',
  title: 'Job',
  type: 'document',
  fields: [
    {
      name: 'page',
      title: 'Page',
      type: 'page',
    },
  ],
};

The reference of page will work where the reference of jobs wont work so i guess theres a type nesting problem regarding reference types

I would be available to go through it in google meet or so to investigate further with you @rexxars if you would like

from gatsby-source-sanity.

roffelsaurus avatar roffelsaurus commented on July 18, 2024

this does work for documents referenced to from inside blockcontent. I use a catch all depth 10 on all graphql queries on blockcontent. could perhaps your nesting be deeper than 10?

from gatsby-source-sanity.

intensr avatar intensr commented on July 18, 2024

roffelsaurus to the rescue !
can you describe closer what you mean with catch all ?
regarding the deeper than 10 thing, i've set it to 5000 just to try but that had no impact.

from gatsby-source-sanity.

chandlervdw avatar chandlervdw commented on July 18, 2024

I am also seeing unresolved references when they are nested

from gatsby-source-sanity.

roffelsaurus avatar roffelsaurus commented on July 18, 2024

from gatsby-source-sanity.

chandlervdw avatar chandlervdw commented on July 18, 2024

For me, it doesn't resolve image references within any bodyPortableText blocks

from gatsby-source-sanity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.