Skip to content

Commit

Permalink
test data and only load necessary stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasJ committed Sep 25, 2024
1 parent 16e8a43 commit 7dd9df0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/graphql/resolver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,28 @@ defmodule AshGraphql.Graphql.Resolver do
[subcription_field_from_action_type(notification.action.type)]
)

case query |> Ash.read_one() do
result =
with {:ok, true, query} <-
Ash.can(
query,
opts[:actor],
tenant: opts[:tenant],
run_queries?: false,
alter_source?: true
),
[] <- query.authorize_results,
{:ok, true} <-
Ash.Expr.eval(query.filter,
record: dbg(data),

Check warning on line 582 in lib/graphql/resolver.ex

View workflow job for this annotation

GitHub Actions / ash-ci / mix credo --strict

There should be no calls to `dbg/1`.
unknown_on_unknown_refs?: true
) do
Ash.load(data, query)
else
_ ->
query |> Ash.read_one()
end

case result do
# should only happen if a resource is created/updated and the subscribed user is not allowed to see it
{:ok, nil} ->
resolution
Expand Down

0 comments on commit 7dd9df0

Please sign in to comment.