-
-
Notifications
You must be signed in to change notification settings - Fork 280
Pagination: support pagination's count
on actions besides reads
#1229
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: support pagination's count
on actions besides reads
#1229
Conversation
@rbino would you have a few to look into this? |
17df397
to
b3a3d3d
Compare
b3a3d3d
to
f517af9
Compare
Ensure that relationships can be correctly loaded, even with pagination, on the resources resulting from create, update and delete actions. Signed-off-by: Davide Briani <davide.briani@secomind.com>
f517af9
to
04057ad
Compare
🚀 Thank you for your contribution! 🚀 |
@@ -178,6 +178,8 @@ defmodule Ash.Actions.Read do | |||
|
|||
query = load_and_select_sort(query) | |||
|
|||
query = add_relationship_count_aggregates(query) |
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 this is now done here shouldn't it be removed from line 435?
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.
yep :)
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'll do that and push it up
Read actions support specifying pagination options on
load
statements for relationships.These options are correctly respected, and the
count: true
option results in Ash counting the total number of related resources and returning the count in the page returned as the loaded relationship.However, actions such as
Ash.update!/3
do not properly respect theload
option since the resultingcount
field is left asnil
.The PR adds a sample failing test.
Contributor checklist