-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: make sure scope filters are used for each fk on includes #7965
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
fix: make sure scope filters are used for each fk on includes #7965
Conversation
|
Thanks, I can see a log from AppVeyor now, and I can recreate it locally. |
b256370 to
1407de6
Compare
|
I think I solved the issue @mrmodise in case you have a chance to re-run the pipeline. |
|
Not sure what's causing problems with rendering the error logs (I'm able to view them fine on Firefox). Here's the logs: |
Thank you!. So what do you recommend me to flatten the array? Array.flat is not available on node 10. |
31bdfea to
4cb6999
Compare
|
I end up using lodash to flatten the array. Tha should solve the problem |
|
The only way I can recreate the timeout error reported by AppVeyor is if I run my laptop on battery and power-saving mode. |
|
The macos pipeline is giving that same |
|
Apologies for the confusion; I re-ran the Appveyor test earlier today. I've just re-ran the GitHub Actions workflows as well. The macOS test does timeout sometimes; We've recently increased this timeout recently to see if this reduces the likelihood of it occurring and will continue to tune it over time. |
Pull Request Test Coverage Report for Build 1331204950Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
@achrinza I personally don't agree with the idea to add property |
|
As a long time LB3 user, I completely agree with @mrbatista |
achrinza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrbatista @collaorodrigo7 I'm open to leaving totalLimit out of this PR if that's preferred; Do you see a downside with adding totalLimit for backwards-compatibility?
I would like to get input from the other maintainers as well @dhmlau @raymondfeng
| scope = cloneDeep(scope); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[If we're keeping totalLimit] Since there's delete scope.totalLimit, can we keep the deep clone to prevent mutations to the user input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes, Good catch. That totally makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed the change you suggested
|
Do you guys have any updates? |
|
I'm not too familiar with how |
|
@achrinza, do you have more review comments before landing this PR? |
|
Thanks, @dhmlau. I am confused about it too. I see that merge commit w/o the signature, but also it shows as no changes on that commit, so I am not sure what happened there. |
|
It might make sense to squash the commits and see. WDYT? |
4bce293 to
a95d984
Compare
I am not too familiar with squash, but it's not letting me squash it. I was able to change the commit message, does that help? |
|
Seems like DCO is running now. Not sure if it's because of your changes. 🤷 |
|
Actually there are quite a few commits in this PR, I'd suggest to squash. To do that, here is what I normally do: In your branch If you grant me the permission, I can help you on this too. |
If a scope filter is passed, the filter should be applied for each foreign key and not globally. This implies a query for each fk, and may impact performance. However, is the only way to respect the scope filter. Example, and include with scope.limit:2 should include 2 instances of the related model for each fk. Previously scope.limit:2 will cause to "only" include 2 related models. fix loopbackio#6832 Allow to set a totalLimit filter in scope to apply a limit globally in case someone relied on this bug thinking it was a feature. docs: add note to include with filters about totalLimit option Signed-off-by: Rodrigo Collao <collao.rodrigo7@gmail.com>
a95d984 to
b8a5f33
Compare
|
Thanks for the detail explanation @dhmlau, that was helpful. |
|
@collaorodrigo7, thanks for working through this. Your PR has landed! 🎉 |


If a scope filter is passed, the filter should be applied for each foreign key and not globally.
This implies a query for each fk, and may impact performance. However, is the only way to respect
the scope filter. Example, and include with scope.limit:2 should include 2 instances of the related
model for each fk. Previously scope.limit:2 will cause to "only" include 2 related models.
Signed-off-by:Rodrigo Collao collao.rodrigo7@gmail.com
fix #6832
Signed-off-by: Rodrigo Collao collao.rodrigo7@gmail.com
Checklist
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated👉 Check out how to submit a PR 👈