You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug(gatsby-source-strapi): GraphQL fragment queries only work if all possible components of a dynamic zone are actually used in the current content
#475
Open
paulwellnerbou opened this issue
Apr 15, 2024
· 1 comment
The GraphQL API exposed by Gatsby considers only existing content. This leads to errors when building/running the project if the current content is not using a certain component in a dynamic zone. But is has to be mentioned/queried to handle it.
Remove all components of (e.g.) "slider" from all example articles
Try to build/run your project
You will get this error:
GraphQLError: Unknown type "STRAPI__COMPONENT_SHARED_MEDIASTRAPI__COMPONENT_SHARED_QUOTESTRAPI__COMPONENT_SHARED_RICH_TEXTSTRAPI__COMPONENT_SHARED_SLIDERUnion". Did you mean "STR
API__COMPONENT_SHARED_MEDIASTRAPI__COMPONENT_SHARED_QUOTESTRAPI__COMPONENT_SHARED_RICH_TEXTUnion"?
Expected behavior
Project should build and run like before, just without the image slider components
I am not completely sure where this bug is supposed to be addressed. Am I doing something wrong? Is the example starter buggy? Is it something in strapi? Or in Gatsby?
The text was updated successfully, but these errors were encountered:
This is a well-known problem: an empty field in an entity (Single type or Collection type) is not detected, and so is not added, or is removed if the field is empty, to the schema.gql file.
There are two ways to solve the problem: either fill all fields for an entity, generate the schema, then block its regeneration (use the gatsby-plugin-schema-snapshot plugin). Or use the 2 plugins I've developed. One for Strapi https://market.strapi.io/plugins/nova-datas-mocker to mock APIS and the other for Gatsby https://github.com/NovaGaia/gatsby-plugin-strapi-datas-mocker#readme to "simplify" the management of this problem.
Describe the bug
The GraphQL API exposed by Gatsby considers only existing content. This leads to errors when building/running the project if the current content is not using a certain component in a dynamic zone. But is has to be mentioned/queried to handle it.
To Reproduce
You will get this error:
Expected behavior
Project should build and run like before, just without the image slider components
System Info
See versions in https://github.com/strapi/starters-and-templates/tree/main/packages/starters/gatsby-blog
I am not completely sure where this bug is supposed to be addressed. Am I doing something wrong? Is the example starter buggy? Is it something in strapi? Or in Gatsby?
The text was updated successfully, but these errors were encountered: