-
Notifications
You must be signed in to change notification settings - Fork 672
[5.7.6]: GraphQL query on an entry with a Matrix field returns duplicates of the actual Matrix blocks #17324
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
Comments
Okay, I have solved this, and I think it is a bug. Or at least unintentional or unwanted behavior. This is caused because of Versioning introduced for Matrix fields as of Craft 5.7: When I disabled "Enable versioning for entries in this field" on field "lookoutArticle" I didn´t get duplicates anymore from GraphQL response. But onyl for new entries created after altering this setting. So, GraphQL as a default, returns all versions of the entries of a Matrix field. This behavior cannot be intentional. From a practical view, it does not make any sense. Desired behavior: GraphQL should only return the latest versions of the entries of a Matrix field no matter if "Enable versioning for entries in this field" is enabled or not. |
Additional question: Is there any query argument I can add to the GraphQL to omit having versioned Matrix field entries in the response? If no, there should be one, at least ;) |
@MartinSchmid2409 |
Hi, thanks for getting in touch and for all the info.
You can add I’m looking into this and will update this issue once I have more info. |
I raised a PR to improve this. |
Craft 5.7.8 is out with that fix. Thanks again! |
What happened?
Description
Below is an actual working query. The problem is the field "lookoutArticle" which is a Matrix field. The actual entry has 5 content blocks inside the matrix field. But the GraphQL query returns lots of duplicates of each of these 5 content blocks (I checked it: same id). I´ve tried all and everything to get rid of these duplicates, but no chance. Google and ChatGPT also did not help. Did I oversee something? I just want to return the entry as it is shown in the Craft CMS admin backend. I want to see a GraphQL response with 5 entries inside the Matrix block (and not ~35).
Steps to reproduce
REQUEST:
RESPONSE:
Expected behavior
GraphQL response: Matrix field entries not duplicated lots of times.
Actual behavior
GraphQL response: Matrix field entries ARE duplicated lots of times.
Craft CMS version
5.7.6
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
"Embedded Assets"
"CKEditor"
"Multi Translator"
"Image Resizer"
The text was updated successfully, but these errors were encountered: