verbb / super-table

Super-charge your Craft workflow using Super Table.
MIT License
316 stars 47 forks source link

gql breaks if you have fields with same handle #461

Open jugsvn opened 2 years ago

jugsvn commented 2 years ago

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

Additional context

Screenshot 2022-05-06 at 1 40 09 PM Screenshot 2022-05-06 at 1 40 43 PM
engram-design commented 2 years ago

Please state what version of the plugin you're using

Stalex89 commented 2 years ago

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 ("itemsBlockType"). Setting one of the fields handle to something else like "items" "solves" the issue.

ce2cs commented 1 year ago

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

jpcarpenter commented 1 year ago

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.