question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Source DatoCMS Single Instance

See original GitHub issue

Description

Single-instance DatoCMS models appear in the playground, but return null when queried. For instance:

datoCmsHome {
    introText
  }

returns

"datoCmsHome": null,

However querying -

allDatoCmsHome {
    edges {
      node {
        id
        introText
      }
    }
  }

- will return

"allDatoCmsHome": {
      "edges": [
        {
          "node": {
            "id": "962827",
            "introText": "I am a creative illustrator and graphic designer with more than 10 years of experience.\n\nOriginally from Toronto, currently based in London."
          }
        }
      ]
    ,

Steps to reproduce

https://github.com/thetre97/gridsome-starter-datocms

Simply create a single instance DatoCMS record, and query with the plugin.

Expected result

datoCmsHome { ... should return the single instance data.

Actual result

"datoCmsHome": null

Environment

"dependencies": {
    "@gridsome/source-datocms": "^0.1.0",
    "gridsome": "^0.6.6"
  },

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
gilesbutlercommented, Oct 27, 2019

Looks like it’s Gridsome side @matjack1.

I think @hjvedvik was saying it will be added to v0.8 if I read that right…

Expect it to be included in v0.8 😃

1reaction
hjvedvikcommented, Oct 25, 2019

@matjack1 We can probably make Gridsome just return the first node in the collection if no id argument is provided 😃 I see that the DatoCMS GraphQL API is doing it.

And we have just implemented filters for single node fields. Expect it to be included in v0.8 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Content modelling - Single instance models - DatoCMS Docs
While collection models enable the creation of multiple records, single-instance models allow just a single item to be edited in the administrative area....
Read more >
gatsby-source-datocms/README.md at master - GitHub
Official GatsbyJS source plugin to pull content from DatoCMS ... SEO meta tags; Tree-like collections; Single instance models; Localized fields.
Read more >
gatsbyjs/gatsby-source-datocms
gatsby-source-datocms Source plugin for pulling models and records into Gatsby from ... Tree-like collections; Single instance models; Localized fields.
Read more >
Gatsby JS v4 & DatoCMS Crash Course (2022) - YouTube
Gatsby v4 and DatoCMS tutorial headless CMS - quick and easy crash course to ... Subscribe if you want more free tutorials like...
Read more >
Hooking up DatoCMS and Gatsby.js | Alvin Crespo
We'll use DatoCMS to manage our content and Gatsby to display it, ... TL;DR - It brings in the content from a model...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found