cms icon indicating copy to clipboard operation
cms copied to clipboard

A table in a matrix with the same handle as a table field overrides the schema for the field

Open Tam opened this issue 3 years ago • 3 comments

Description

A table field that shares the same handle as a table field in a matrix will have it's type handle_TableRow overridden in the graph schema.

For example, if I have a table in a matrix field called answers and a top-level table field called answers, both will point to the same schema type of answers_TableRow. The properties of this schema will match only one of the types, meaning the values for the other will be incorrect.

Steps to reproduce

  1. Create a table field
  2. Create a matrix field containing a table of the same handle as the above but different columns
  3. Try to query the data from both

Additional info

  • Craft version: 3.7.35
  • PHP version: 8.1.1
  • Database driver & version: MySQL 5.5.5

Tam avatar Mar 02 '22 15:03 Tam

This is currently slated for Craft 5.0 as this is highly likely to break existing GraphQL queries.

andris-sevcenko avatar Mar 29 '22 12:03 andris-sevcenko

Any update on this? I see it was removed from the 5.0 milestone. We just spent a bunch of time trying to debug why a nested field (SuperTables inside a Matrix, in our case) wasn't coming through in the schema before finally tracking it down to this issue. At the very least, it seems worth calling out in the GraphQL documentation, as sharing the same field handle across multiple Matrix blocks is very common in my experience, especially in a content-builder style setup.

elivz avatar Aug 18 '23 12:08 elivz

Yep, it’s already resolved for 5.0 actually :) Will update the issue once the solution is public.

brandonkelly avatar Aug 18 '23 22:08 brandonkelly