Skip to content

Commit

Permalink
fix: don't assume required pagination in actions means relationships …
Browse files Browse the repository at this point in the history
…are paginated

It would be a breaking change to assume that if the destination action is
paginated that we must use pagination for that relationship.

This may, unfortunately, break some clients that were relying on this
behavior. Specifically, anyone with required keyset pagination on
their primary read actions. There is not much I can do to address that.

For affected users: use the `paginate_with` option, or set this config
in config.exs:

```elixir
config :ash_graphql, :required_pagination_extends_to_relationships
```

I'm not documenting that configuration for now because I don't think
that it should be the default behavior. Too "spooky action at a distance"
to modify the relationship resolvers when editing actions. It doesn't
even work that way in Ash core.
  • Loading branch information
zachdaniel committed Dec 1, 2024
1 parent ad956e6 commit e9e4638
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/resource/resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1564,8 +1564,12 @@ defmodule AshGraphql.Resource do

defp pagination_strategy(strategy, action, allow_relay?) do
strategies =
if action.pagination.required? do
[]
if Application.get_env(:ash_graphql, :required_pagination_extends_to_relationships, false) do
if action.pagination.required? do
[]
else
[nil]
end
else
[nil]
end
Expand Down

0 comments on commit e9e4638

Please sign in to comment.