Ash FrameworkAF
Ash Frameworkโ€ข7d agoโ€ข
19 replies
Rutgerdj

Shared context not accessible in child actions via `manage_relationship`

I have a create action on a parent resource where i set some context:
# parent create action
create :create do
  primary? true

  accept :*
  argument :sections, {:array, :map}

  change set_context(%{shared: %{testabc: 123}})

  change manage_relationship(:sections, :sections, type: :create)

end


Then in the child resource I would expect the %{testabc: 123} to be available on the context but it is not.

    # child create action
    create :create do
      primary? true

      accept :*
      argument :values, {:array, :map}

      change fn x, y ->
        Map.keys(x.context) |> dbg
        Map.keys(y) |> dbg
        Map.keys(y.source_context) |> dbg
        x
      end

      change manage_relationship(:values, :values, type: :direct_control)
    end


Both debug statments only have these keys:
Map.keys(x.context) #=> [:private, :accessing_from]

Map.keys(y) #=> [:tracer, :__struct__, :tenant, :authorize?, :actor, :source_context, :bulk?]

Map.keys(y.source_context) #=> [:private, :accessing_from]


Am i missing something?
Solution
GitHub
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 as...
Was this page helpful?