-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
New Eager Loading Bug! #249
Comments
Woah! Nice find, I'll take a look after work 😊 |
My guess is that this condition should be modified to say: if (skip && !query.opts.includes) { I might have time to check if that works after lunch. Haven't gotten Model's tests running locally somehow. Need to take the time. |
Actually that could be the pre-query, not sure.. |
had an unusually long day at work, going to have to defer this to tomorrow 😞 ping me on twitter if i forget! i have it on my to-do list. |
Yeah no hard feelings, I had a long day too. Hope you beat those tasks back soon! |
Expected it to fail as I've had problems with this type of request (geddy#249), but was unable to replicate, the test is passing here.
I wrote a test for what I described, but it's passing. If I can't replicate this soon I'll just close it, maybe something else is going on. These tests seem to suggest that having an offset of 2 will wrap around the set if there are only two results for the query. |
Hey @ben-ng, it's been a while, but I think I found a bug in eager-loading when using it with pagination!
If I have a bunch of posts and their users, and I want to paginate, I might make a query like this:
which will first fetch the IDs of the relevant posts in an appropriate way, something like:
Which is working fine. The problem is that currently, the follow-up detail request KEEPS the offset, even when querying by ID, which means it skips all the correct results, and returns an empty array:
This breaks pagination when using eager loaded associations! I think I've boiled it down it should be a quick fix, so I might take a look in there, but I'm sure it would be easier for someone who already has worked with this.
The text was updated successfully, but these errors were encountered: