I can expand on this as much as you want so I'll just put down the basic info for now.
If I have a mutation in a phoenix controller (in a @graphql module attribute), like this:
@graphql """
mutation UpdateMenuItem($id: ID!, $description: String!) {
update_menu_item(id: $id, input: {description: $description}) {
errors { key message }
menu_item {
name
description
}
}
}
"""
def update(conn, %{data: %{update_menu_item: %{errors: nil, menu_item: menu_item}}}) do
# ... controller update logic here, conn |> redirect or whatever
end
And if this mutation is meant to trigger a subscription, for example if my schema.ex is like this:
subscription do
field :updated_menu_item, :menu_item do
config(fn _args, _info ->
{:ok, topic: "*"}
end)
trigger(:update_menu_item,
topic: fn
%{menu_item: menu_item} -> ["*"]
_ -> []
end
)
resolve(fn %{menu_item: menu_item}, _, _ ->
{:ok, menu_item}
end)
end
# more subscriptions,etc.
end
then the subscription is not triggered. This might have something to do with how the Absinthe.Phoenix SDL is processed differently to normal Graphql SDL.
I can expand on this as much as you want so I'll just put down the basic info for now.
If I have a mutation in a phoenix controller (in a
@graphqlmodule attribute), like this:And if this mutation is meant to trigger a subscription, for example if my
schema.exis like this:then the subscription is not triggered. This might have something to do with how the Absinthe.Phoenix SDL is processed differently to normal Graphql SDL.