Skip to content
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

Pagination breaks on some sequelize models #136

Closed
robertmatogen opened this issue Sep 20, 2017 · 4 comments
Closed

Pagination breaks on some sequelize models #136

robertmatogen opened this issue Sep 20, 2017 · 4 comments
Assignees
Labels

Comments

@robertmatogen
Copy link

Hi there.

Thank you for the great product.

We are finding good uses for it in our system. During development however we encountered an issue.

It seems as if with most sequelize models pagination works. In other words, if we go to the tables on the Forest Admin panel and if we have 21 entries, we see 10 on the first page etc.

On some models, this behaviour breaks. We have a table with 1093 records and displaying all of it grinds the system to a halt.

We saw the following in our logs (i.e. sequelize logs this out) when comparing the queries made for the working and non-working models.

  1. The first model works and we see:
Executing (default): SELECT "DbUser"."Id", "DbUser"."Name"  FROM "Users" AS "DbUser" LEFT OUTER JOIN "JuristicEntities" AS "JuristicEntity" ON "DbUser"."JuristicEntityId" = "JuristicEntity"."Id" ORDER BY "DbUser"."Id"
DESC LIMIT 10 OFFSET 0;
  1. The second model breaks and we see:

Executing (default): SELECT "Id", "Name"
FROM "JuristicEntities" AS "DbJuristicEntity";

We noticed that the LIMIT is missing on the second query.

This issue seems to be related to an issue that was addressed with the following pull request: #134

After some digging around, we saw that if we remove the include property on line 132 of the resources-getter.js file, we seem to get pagination working again. (But we are unsure what we are breaking in the process)

Any advice or assistance with this will be highly appreciated.

@arnaudbesnier
Copy link
Member

arnaudbesnier commented Sep 20, 2017

Hey @robertmatogen, you project seems to be using Sequelize 3.24.8 so it is not related to #134 that fixes a specific issue on Sequelize 4.8.+.

We've noticed that you are using forest-express-sequelize package version 1.1.17 (which is 2 month old). Can you upgrade this package with the following command:

npm install --save forest-express-sequelize@latest

And then try to reproduce

@robertmatogen
Copy link
Author

Hi @arnaudbesnier

Thanks for the response. We initially had the devel branch set up in our package.json, like this

"forest-express-sequelize": "git://github.com/ForestAdmin/forest-express-sequelize.git#devel"

because of the issue mentioned in #134 . I just changed and updated to the latest version, which seems to be 1.4.0.

But unfortunately we still have the same issue.

Here are the versions of some of the packages in our project:

forest-express-sequelize: 1.4.0,
pg: 7.3.0,
sequelize: 4.8.3,
sequelize-typescript: 0.4.0,

@arnaudbesnier
Copy link
Member

Could you give us your Forest project url to help us investigate deeper.
The only project I find for you does not reflect such configuration (still on forest-express-sequelize 1.1.17 on sequelize 3.24.8) but I might be looking a the wrong project.

@robertmatogen
Copy link
Author

Hi @arnaudbesnier

Thank you for your time.

We were able to get to the root of our problem. This seems to have been an issue with the version of sequelize-typescript that we were using. After upgrading to 0.5.0, it seems to be working fine again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants