Ash FrameworkAF
Ash Framework3y ago
3 replies
Blibs

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


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.
Was this page helpful?