-
-
Couldn't load subscription status.
- Fork 70
Description
Code of Conduct
- I agree to follow this project's Code of Conduct
AI Policy
- I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.
Versions
Ash Graphql 1.8.2
Operating system
Mac
Current Behavior
I discovered an issue with subscriptions with read_actions where there are authorization filters and the read action has pagination setup (common when using Relay).
When this happens, the record gets added to the list of records which need to be refetched to assure the actor is authorized to see it. In the resolver, we call do_refetch on those records, which ends up calling Ash.read with the query. Unfortunately, if the read action has pagination, the Ash.read correctly returns an {:ok, Ash.Page.Keyset} (or Offset), which then crashes because the resolver is expecting {:ok, []} type results.
Fortunately there's an easy workaround, which is to update the read action pagination so that required? is false (which I didn't know was an option!). Another workaround is to have a separate read action which doesn't have pagination, and use that for the subscription.
I wonder if this is something that should be fixed in the resolver to handle Keyset or Offset returns (but then do we iterate all the records?), or is there a way to specifically tell Ash to skip pagination (even if it's required?), or maybe just a limitation that should be documented?
Reproduction
No response
Expected Behavior
No response