super-table icon indicating copy to clipboard operation
super-table copied to clipboard

gql breaks if you have fields with same handle

Open jugsvn opened this issue 3 years ago • 4 comments

Description gql queries return the wrong object if we have fields with the same handle. One defined under Fields and another defined inside a Matrix.

Steps to reproduce

  1. Add a Super Table field called Tiles under Fields with handle tiles.
  2. Add a Matrix field called Content under Fields and inside the Matrix add a Super Table field called Tiles with handle tiles.

Now run a gql query to retrieve the second field inside the Matrix. But what gets returned is the first field.

This is because of the entry in GqlEntityRegistry as both the fields share the same typename.

Additional info

  • Plugin version:
  • Craft version:
  • Multi-site: Yes or No

Additional context Screenshot 2022-05-06 at 1 40 09 PM Screenshot 2022-05-06 at 1 40 43 PM

jugsvn avatar May 06 '22 08:05 jugsvn

Please state what version of the plugin you're using

engram-design avatar May 15 '22 00:05 engram-design

I have the same issue, if one matrix block has a field that shares the field handle with the field of another block, GraphQL will not be able to see the content of the second field.

Plugin version: 3.0.0 Craft Version: Craft Pro 4.2.3 PHP version: 8.0.22 Database: MySQL 10.2.44

Screenshots:

Screenshot 2022-09-12 at 10 22 17

Screenshot 2022-09-12 at 10 22 27

Screenshot 2022-09-12 at 10 24 52

In this example I have "items" handle shared across fields in two separate blocks, and the "item" field of CTA block has a "color" field in it, however it is not visible by GraphQL. Looks like they share the same scheme handle in this case ("items_BlockType"). Setting one of the fields handle to something else like "items_" "solves" the issue.

Stalex89 avatar Sep 12 '22 08:09 Stalex89

Same here, I work around it by changing to a unique handle name

ce2cs avatar Nov 14 '22 22:11 ce2cs

We've been encountering this same issue since Craft 2. We also end up just changing the handle to a unique name, but would absolutely love a solid fix for this.

jpcarpenter avatar Jan 31 '23 16:01 jpcarpenter