You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using deep filters it is possible to break pagination such that you get hasNextPage returning false when there are more rows.
This seems to stem from the sql producing duplicate rows when doing left joins and thinking it's hit the end of the list.
My team noticed that there's some code that seems to look for oneToMany/manyToMany relationships and switch to a skip-take stratergy, however it only looks for this type of relationship in the first layer of filters. I believe we need to look for these relationships at any depth of filter for this behaviour to work properly.
Describe the bug
When using deep filters it is possible to break pagination such that you get
hasNextPage
returning false when there are more rows.This seems to stem from the sql producing duplicate rows when doing left joins and thinking it's hit the end of the list.
My team noticed that there's some code that seems to look for
oneToMany/manyToMany
relationships and switch to askip-take
stratergy, however it only looks for this type of relationship in the first layer of filters. I believe we need to look for these relationships at any depth of filter for this behaviour to work properly.Here's a minimal reproduction of the issue:
https://github.com/Smtih/nestjs-query-pagination-bug/blob/master/test/paging-bug.e2e-spec.ts
(Please have postgres running using docker-compose if trying to reproduce)
The gist of the setup is:
TodoItems have a one-many relation with subtasks
TodoItems have a one-many relation with tags
if we query a paginated list of subtasks, and filter on a condition on tags (via todos) we will hit this bug.
I think we are close to having a PR we can submit to fix the issue that I'll also raise soon.
The text was updated successfully, but these errors were encountered: