Skip to content

Commit

Permalink
Run subquery modify prior to applying pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaSemenov committed Dec 10, 2024
1 parent 0813552 commit 8d7c54c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/clean-hounds-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"objection-graphql-resolver": patch
"orchid-graphql": patch
---

Run subquery modify prior to applying pagination.
3 changes: 2 additions & 1 deletion packages/base/src/resolvers/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ export function definePageResolver<Orm extends OrmAdapter, Context>(
relation: tableField || field,
as: field,
modify(subquery) {
subquery = modify ? modify(subquery, context) : subquery
subquery = graph._resolve_page(subquery, paginator, context)
subquery = graph.orm.modify_subquery_pagination(
subquery,
pagination_context,
)
return modify ? modify(subquery, context) : subquery
return subquery
},
})
query = graph.orm.finish_query_pagination(query, field, pagination_context)
Expand Down

0 comments on commit 8d7c54c

Please sign in to comment.