v4.50.0 changes naming of nested GraphQL fragments
Bug description
Fragments names for nested fields have changed. I will try to add more detail later.
Before:
fragment SetButtons on Set_TextRich_Buttons {
...
}
After:
fragment SetButtons on Set_PageBuilder_TextRich_Buttons {
...
}
How to reproduce
Upgrade to 4.50.0
Logs
No response
Environment
Environment
Laravel Version: 9.52.16
PHP Version: 8.3.3
Composer Version: 2.7.1
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Antlers: runtime
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.50.0 PRO
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
Runtime (default)
Additional details
No response
Can you provide the YAML file contents for the relevant blueprint?
Sure, here it is
page_builder.yaml
title: 'Page Builder'
fields:
-
handle: page_builder
field:
sets:
main:
sets:
text:
fields:
-
import: page_builder_text
page_builder_text.yaml
title: 'Page Builder Text'
fields:
-
handle: text_rich
field: common.text_rich
common.yaml
title: Common
fields:
- handle: text_rich
field:
sets:
main:
sets:
buttons:
display: Buttons
instructions: null
icon: direction-buttons
fields:
- import: buttons
type: bard
buttons.yaml
title: Buttons
fields:
- handle: buttons
field:
fields:
- import: button
type: grid
Same behaviour here since the update to v4.51
We have two replicators with the handles:
- components
- sidebar_components
Each replicator contains a set of fieldtypes which we define in the frontend as reusable query string for graphql. Before the update we could use the same string "fragment" for both replicators:
export const ComponentLinks = `
type
heading
links {
... on Set_Links_Links {
id
link
title
}
}
`
So e.g. to fetch the replicator on the page:
components {
... on Set_Components_Links {
${ComponentLinks}
}
}
sidebar_components {
... on Set_SidebarComponents_Links {
${ComponentLinks}
}
}
Since the update it is necessary to prefix the Set_Links_Link with the parent replicator handle:
export const ComponentLinks = `
type
heading
links {
... on Set_Components_Links_Links {
id
link
title
}
}
`
export const SidebarComponentLinks = `
type
heading
links {
... on Set_SidebarComponents_Links_Links {
id
link
title
}
}
`
Would you be able to confirm the exact version where this behavior starts changing?
We updated from v4.46 to v4.51 Just tested it: v4.49 works -> v4.50 needs the query changes
Yes, can confirm that. It starts with 4.50
Thank you
Yes this is currently preventing us from updating Statamic, as it breaks all defined graphQL fragments in the application.
We are also blocked from upgrading Statamic for the same reason. We've locked the version to 4.49 for now.
What is the status of this issue? The ticket has been open since March. Does this mean that the GraphQL nested fields schema has changed permanently? We are also blocked from updating Statamic as many GraphQL fragments broke.
I understand this has unintentionally changed at some point which shouldn't have in a non-breaking release.
However, I don't see why it's stopping you from updating. Statamic 5 is a major release with breaking changes. Can't you also change your queries to use the updated names as part of the update?
-fragment SetButtons on Set_TextRich_Buttons {
+fragment SetButtons on Set_PageBuilder_TextRich_Buttons {
These new names seem more correct as they are scoped to the field.