We are running into the problem that totalCount is wrong when using paginate with inner joins (most likely only with many-to-many relations but did not dig deeper). A workaround is to pass distinct: true parameter to .paginate() because since https://github.com/Kaltsoon/sequelize-cursor-pagination/commit/401972bdcfc87e8c07658c234c6cc150b46f1888 the query args are passed also to .count() and that fixes the issue. But now typescript is complaining because .paginate() only takes FindOptions and that type does not include distinct.
I would suggest to either update the type to include also CountOptions or include distinct: true in totalCountQueryOptions and cursorCountQueryOptions.
We are running into the problem that totalCount is wrong when using paginate with inner joins (most likely only with many-to-many relations but did not dig deeper). A workaround is to pass
distinct: true
parameter to.paginate()
because since https://github.com/Kaltsoon/sequelize-cursor-pagination/commit/401972bdcfc87e8c07658c234c6cc150b46f1888 the query args are passed also to.count()
and that fixes the issue. But now typescript is complaining because.paginate()
only takesFindOptions
and that type does not includedistinct
.I would suggest to either update the type to include also
CountOptions
or includedistinct: true
intotalCountQueryOptions
andcursorCountQueryOptions
.