ash-project / ash_graphql

The extension for building GraphQL APIs with Ash
https://hexdocs.pm/ash_graphql
MIT License
73 stars 49 forks source link

`manual` callback not getting called in the `read_action` of an update mutation #190

Closed moxley closed 4 months ago

moxley commented 4 months ago

Describe the bug

When I define an update mutation, with an identify false and read_action action_x, the manual callback defined in action_x does not get called.

To Reproduce

  1. Make the following change to the ash_graphql test suite: https://github.com/moxley/ash_graphql/commit/a98e6ef9def38b9f53a74e39f71423827045f786
  2. Run the AshGraphql.UpdateTest.:"an update with a configured read action and no identity works"/1 test.
  3. The dbg() statements in AshGraphql.Test.CurrentActorRead.read() do not output anything.

Expected behavior One of the dbg() statements should output something.

** Runtime

Additional context

This might be what is causing this situation.

It would be nice if AshGraphql had a more straightforward way to handle the case where a user needs to update their own user record. Am I doing it the recommended way?

Also, I noticed the test still passes with the following expression in the :best_post action commented out:

# filter(expr(best == true))
zachdaniel commented 4 months ago

This is actually a bug in ash core, fixed in 3.1.2. Thank you for the detailed report and helping to identify the issue! 🙇