Is it possible to disable pagination entirely for a read action?
I'm using AshGraphQL, and I have a pretty bespoke read action that through some reasonably complex logic related to some custom arguments kind of "self-paginates" - the implementation and design reasons for this are more than is worth explaining here, and yes, I wish it were different than it is and may even refactor away from this in the future, but that will take some time to do... for now, suffice to say that when generating my graphql schema, I'd really love to be able to not show the pesky
limit
and offset
params in queries/relationship loads, since the bespoke logic of the action kind of already accomplishes what pagination is doing, so it's confusing for the front end devs that consume my API to see those pagination params that are functionally redundant.
I found paginate_with and paginate_relationship_with, which seem to imply that I might be able to pass nil
to disable pagination, but afaict that doesn't seem to do it. Is this something that's supported?8 Replies
Actually taking a closer look, it seems like this mostly applies to the relationship case, seems like
paginate_with nil
does what I expected, it's just the relationship case where paginate_relationship_with my_relationship: nil
still winds up with a limit
and offset
param
I'm increasingly thinking this is just a bug. ash_graphql source code ->
root level query case:
relationship query case:
feels like the relationship case should also be nil -> []
?That sounds right to me, yeah
oh
um...
no
relationships always supported limit/offset
Solution
You'll have to add a
:none
atomAlright, can do
Is this just to avoid a technically breaking change, or is there like a design reason I'm missing that relationships should default to that even if it's not specified?
Yeah its to avoid a breaking change
We didn't used to have an option here
all relationships just always supported limit/offset lol
Gotcha, yeah avoiding the breaking change makes sense
https://github.com/ash-project/ash_graphql/pull/336
For anyone running onto this thread in the future:
The above PR didn't quite cut it, I also implemented this follow up PR
The first PR was released in 1.7.16, second one is pending release and will presumably be released in 1.7.17 (whenever that is). So the
:none
setting won't do anything until 1.7.17I'll release that now