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
I'm having some difficulty querying for my Flexible Content data with GraphQL.
I've been using the recommended inline fragments and everything has been working fine until just yesterday.
Now Gatsby is generating GraphQL Union nodes that differ from one build to the next.
My Flexible Field has the ACF key content_block, and it currently has four layouts: quote, link, image_and_text, image_and_content. The resulting GraphQL Unions look like this:
The order changes on each build, even though I haven't added, changed, or removed any of the layouts.
I'm trying to create a reusable fragment like this:
export const contentBlockQuery = graphql`
fragment content_block on [Union_blocks_page...] {
__typename
... on WordPressAcf_quote {
text
source
}
... on WordPressAcf_link {
text
link
}
(etc)
}
`
This fragment fails to compile because that Union node keeps changing.
Is there something I can do to make sure that the Union node stays consistent?
Is there something more generic that I can use in the GraphQL fragment for the "on" target?
The text was updated successfully, but these errors were encountered:
Hmm, we probably could make it to stay somewhat consistent by sorting types before joining them but this still would not be bullet proof (i.e. if you would never use one of your layouts name would change again). This is definitely problematic, I will prepare PR with bandaid solution, but long term solution is so either user or source plugin could declare schema types.
I'm having some difficulty querying for my Flexible Content data with GraphQL.
I've been using the recommended inline fragments and everything has been working fine until just yesterday.
Now Gatsby is generating GraphQL Union nodes that differ from one build to the next.
My Flexible Field has the ACF key
content_block
, and it currently has four layouts:quote
,link
,image_and_text
,image_and_content
. The resulting GraphQL Unions look like this:The order changes on each build, even though I haven't added, changed, or removed any of the layouts.
I'm trying to create a reusable fragment like this:
This fragment fails to compile because that Union node keeps changing.
The text was updated successfully, but these errors were encountered: