Closed jasewarner closed 1 year ago
What about only populating the strapi_id
in your query and then in your Componenbt make another query to populate the needed field?
Components are available in your GraphiQL you can try it out
I'm probably missing something (Strapi noob here), but surely I wouldn't be able to get strapi_id
for a component that isn't being used in the dynamic zone on a particular page?
For example, if I'm not using the "Text and Image" component in my page, querying the following would cause the query to fall over:
... on STRAPI__COMPONENT_BLOCK_TEXT_AND_IMAGE {
strapi_id
}
Right? Or have I got the wrong end of the stick?
I think since strapi_id
is common to all components you should be able to query it outside any fragment
Edit: I just tested it and it doesn't work outside fragments. That's not what we want indeed
Yes but since a node is created we should be able to query it anyway, right?
We're able to query it if we know the ID of the component to query, but what if we don't?
Yeah, I just get an "Unknown type" error from my GraphQL query.
We're able to query it if we know the ID of the component to query, but what if we don't?
You'll always know the id of the component
Thanks for your interest in this project. This plugin is moving into the Gatsby User Collective and this repo will be archived. Please open an issue in that repository, submit a PR if you'd like to see this implemented, or join us on Discord if you have questions!
Does anyone have any pointers on using fragments in graphql queries to retrieve blocks from a dynamic zone when not all of the blocks will necessarily have been included in a single content type?
For example, when editing my
page
single content type, if I only use two of the three blocks, my query falls over.Here's my query: