New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The pagination returns wrong totalItems, pageCount, next, previous page links #258
Comments
Yep. I'm having the same issue. I'm asking for 10 items per page but only receiving 5. Depending on the page the item count will be different. Sometimes I'll get back 6 items, sometimes 8, etc. Some of my models work perfectly fine. When I run the query TypeORM generates directly on the database I get 10 items |
The problem seems to be solved in master, however when installing from npm, you don't get the latest version. I ended up removing the package from my project and copied all the files from master manually. |
Hey guys, sorry I've been really slow recently. Going to be working on the changes in master in the next few days and finishing things off and deploying :) sorry for taking so long! |
All good. Thanks for creating this package. It saved me a lot of time. |
@bashleigh , same issue here, when join table in many-to-many itemCount and totalItems does not work well... do you have any position? Thanks. |
@kauandotnet can you show me your implementation and the query string please if you can? |
Service:
Repository Query:
Line:
Plan:
|
any update on this |
@kauandotnet I think using select or left joins has resulted in your error. I quite often hydrate my results if I need to as that's what typeorm does when using joinTables + eager loading. I know it sounds less desired than left joins but it means the results for the pagination are correct! However I would recommend before doing this, making sure your outputted query results in the correct amount of line. So set |
After you've updated, everything is working now... |
The pagination returns wrong totalItems, pageCount, next, previous page links even when coupled with a where clause.
When there are 4 rows in my table for user 1, and user 2
This should return
totalItems: 2
,pageCount: 2
,next: /payments?page=1&limit=1
,previous: ''
...but this is what i'm getting.
Extra optional parameters are not taken into account while the total pages are calculated? Why are total items showing 4 for
user_id = 2
when it should be2
instead.The text was updated successfully, but these errors were encountered: