[13.x] Fix N+1 queries on JSON:API resource collection includes
Merged
XU
10d ago+59+59+01234567890123456789-0-0-0123456789
Hey Taylor, #62000 fixed N+1 queries for includes on a single resource, but collections still load each item's includes one model at a time:
GET /users/1?include=posts.comments → 3 queries
GET /posts?include=author.profile → 8 queries for 3 posts
Now the requested includes are loaded once for the whole collection before the resources are resolved, so it's 4 queries regardless of the page size. This reuses the loading from #62000.
Fixes #61252.