I'm back again for your daily dose of issues submitted by me 馃槄:
When you have a matrix within a single entry (which naturally doesn't ever have a parent - I'll explain why I do this later) and you try to eager load a parent as well as say an asset in a matrix it won't attempt to load the asset at all. Take the following query:
query {
entry(section: "test") {
parent {
slug
}
... on test_test_Entry {
imageMatrix {
... on imageMatrix_image_BlockType {
image {
id
}
}
}
}
}
}
It will return:
{
"data": {
"entry": {
"parent": null,
"imageMatrix": [
{
"image": []
}
]
}
}
}
However, if you remove the parent selector:
query {
entry(section: "test") {
... on test_test_Entry {
imageMatrix {
... on imageMatrix_image_BlockType {
image {
id
}
}
}
}
}
}
You will get the expected result:
{
"data": {
"entry": {
"imageMatrix": [
{
"image": [
{
"id": "5"
}
]
}
]
}
}
}
Now, I fully understand that I'm not supposed to select a parent on a single and I can totally get around this problem by simply not selecting a parent in singles. This would however make me have to repeat myself in my GraphQL queries a lot as someone may want to re-use the same query for when a single page is similar to a structure or channel like so:
query ($site: [String], $section: [String], $slug: [String]) {
entry (site: $site, section: $section, slug: $slug) {
id
slug
parent {
slug
}
# Index pages
... on aboutIndex_aboutIndex_Entry {
subPageSections {
... subSections
}
}
# Entry pages
... on about_about_Entry {
subPageSections {
... subSections
}
}
}
This would have to become something like this, and then repeated for every non single we want to be able to fetch in the same dynamic query:
query ($site: [String], $section: [String], $slug: [String]) {
entry (site: $site, section: $section, slug: $slug) {
id
slug
# Index pages
... on aboutIndex_aboutIndex_Entry {
subPageSections {
... subSections
}
}
# Entry pages
... on about_about_Entry {
parent {
slug
}
subPageSections {
... subSections
}
}
}
It also worked as expected in Craft 3.4 so I think this might be a bug with the new eager loading logic in 3.5 馃槃
It may be related to https://github.com/spicywebau/craft-neo/issues/349 (not a craft issue) and somewhat related to #6294 although not entirely for either of them
I'm unable to reproduce this.
Any chance you could zip up a database dump + your composer.lock and composer.json files, and send them over to [email protected] while referencing this issue?
I can't re-create this in a fresh installation using matrix blocks anymore. I can however re-create it when using Neo Matrix fields now, but I'm not sure if that's a Craft bug or a Neo bug at this point
Think I found the bug. Gonna keep you posted!
@Marcuzz This should be fixed now. Run composer update and you should be good to go.
Thank you guys for the awesome and quick work you're doing. We really appreciate it 鉂わ笍馃槂馃帀