From e9e46383aefd95ecef1b1ebe50305680f8a4e4e2 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Sun, 1 Dec 2024 16:54:57 -0500 Subject: [PATCH] fix: don't assume required pagination in actions means relationships 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. --- lib/resource/resource.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/resource/resource.ex b/lib/resource/resource.ex index 4743ab3..81d50f9 100644 --- a/lib/resource/resource.ex +++ b/lib/resource/resource.ex @@ -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