Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.50.0 changes naming of nested GraphQL fragments #9633

Open
el-schneider opened this issue Mar 2, 2024 · 8 comments
Open

v4.50.0 changes naming of nested GraphQL fragments #9633

el-schneider opened this issue Mar 2, 2024 · 8 comments
Assignees
Labels

Comments

@el-schneider
Copy link
Contributor

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

@duncanmcclean
Copy link
Member

Can you provide the YAML file contents for the relevant blueprint?

@el-schneider
Copy link
Contributor Author

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

@Kylewalow
Copy link

Kylewalow commented Mar 5, 2024

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
      }
    }
`

@jasonvarga
Copy link
Member

Would you be able to confirm the exact version where this behavior starts changing?

@Kylewalow
Copy link

We updated from v4.46 to v4.51
Just tested it: v4.49 works -> v4.50 needs the query changes

@el-schneider
Copy link
Contributor Author

Yes, can confirm that. It starts with 4.50

@jasonvarga
Copy link
Member

Thank you

@jasonvarga jasonvarga self-assigned this Mar 5, 2024
@thomas4Bitcraft
Copy link

Yes this is currently preventing us from updating Statamic, as it breaks all defined graphQL fragments in the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants