Keyset pagination doesn't seem to use default_limit value

I have this action:
read :list_by_address do
argument :address, :string, allow_nil?: false

pagination keyset?: true, default_limit: 10, required?: true

filter expr(fragment("? %> ?", normalized_full_address, ^arg(:address)) and not deleted?)

prepare build(
sort: [
normalized_full_address_similarity: {:desc, %{address: arg(:address)}},
updated_at: :desc
]
)
end
read :list_by_address do
argument :address, :string, allow_nil?: false

pagination keyset?: true, default_limit: 10, required?: true

filter expr(fragment("? %> ?", normalized_full_address, ^arg(:address)) and not deleted?)

prepare build(
sort: [
normalized_full_address_similarity: {:desc, %{address: arg(:address)}},
updated_at: :desc
]
)
end
I expect that, if I call this action, it would add a LIMIT 10 to the generated SQL query. but it actually adds a LIMIT 251. Seems like the default_limit value is being ignored for some reason. If I run the query with page: [limit: 10] then it works fine.
3 Replies
ZachDaniel
ZachDaniel2y ago
Hey there @Blibs would you mind opening an issue on ash for this? Will address when I'm back from vacation.
Blibs
BlibsOP2y ago
GitHub
default_limit option in keyset pagination is ignored · Issue #668 ·...
Describe the bug The documentation says that we can define a default limit value for keyset pagination using the default_limit option. Seems like that value is being ignored since the query generat...
ZachDaniel
ZachDaniel2y ago
🙇‍♂️

Did you find this page helpful?