I'm using Gatsby with Netlify CMS and ran in the problem with previewing templates in Netlify CMS.
There is an index page component which works as expected. It gets the data from markdown and frontmatter and is linked with
Netlify CMS widgets and there is featured posts component which gets its data via useStaticQuery
hook.
But once I go to index page preview template in Netlify admin I get:
Error: The result of this StaticQuery could not be fetched.
This is likely a bug in Gatsby and if refreshing the page does not fix it, please open an issue in https://github.com/gatsbyjs/gatsby/issues
useStaticQuery
./.cache/gatsby-browser-entry.js:1
> 1 | import React from "react"
2 | import PropTypes from "prop-types"
3 | import Link, {
4 | withPrefix,
View compiled
_default
./src/components/common/FeaturedPosts.js:1
> 1 | import React from 'react'
2 | import v4 from 'uuid'
3 | import { useStaticQuery, graphql } from "gatsby"
4 |
View compiled
▶ 28 stack frames were collapsed.
My goal is to render homepage from markdown and frontmatter data coming from Netlify CMS and featured blog list component which gets its data from /posts
directory via useStaticQuery
hook in Netlify Admin.
The reproduction repo can be found here