Polymorphic interfaces break the prefetch cache when a nested field has filters/ordering applied.
This works:
{
allIndividualCreatives { # Not polymorphic
edges {
node {
id
creativeWorkPortfolioProjects(order: { profileOrder: ASC}) { # β
Filter works without breaking prefetching
edges {
node {
id
}
}
}
}
}
}
}
This also works:
{
jobPosting(id: "Q3JlYXRpdmVKb2JQb3N0aW5nOjMyNQ==") {
applications {
edges {
node {
id
creative { # Polymorphic
creativeWorkPortfolioProjects { # β
Nested three levels deep, but prefetch doesn't break
edges {
node {
id
}
}
}
}
}
}
}
}
}
This doesn't:
{
jobPosting(id: "Q3JlYXRpdmVKb2JQb3N0aW5nOjMyNQ==") {
applications {
edges {
node {
id
creative { # Polymorphic
creativeWorkPortfolioProjects(order: { profileOrder: ASC}) { # β Nested 3 levels deep and prefetch breaks because of the filter
edges {
node {
id
}
}
}
}
}
}
}
}
}
Apparently the prefetched cache is being sent to the subclass, but the filters are being applied to the parent class. I know this because I see error messages about an n+1 query on the parent class only when applying the filters.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too