Fork me on GitHub
#pathom
<
2024-01-20
>
grant19:01:01

Does anyone have an example doing mutations with pathom3-graphql? Maybe it’s in the docs and I’m just missing it, but I haven’t been able to figure out how to make it work yet.

Tyler Nisonoff21:01:53

do these docs help at all? https://pathom3.wsscode.com/docs/integrations/graphql#mutations Haven't tried it yet, but found these helpful for reads!

grant00:01:06

Thanks for the pointer Tyler. Unfortunately, they pretty much describe what I’m doing. The only difference I see it that I am quoting the list form so Clojure doesn’t try to evaluate it as a function.

grant18:01:37

So, I eventually figure out what was going wrong. One problem I had, was sending an enum type value as a string. GraphQL did not like having the value in quotes. The other thing I found necessary to make mutations work was to not use the mutation by itself. I had to ask for some value back or it would blow up. So, this works,

(p.eql/process
  env
  [{`(gql.Mutation/createComputingDeviceAsset {:input {:name "CoolName" :asset_type computing_device}})
    [:gql.ComputingDeviceAsset/name]}])
But, this,
(p.eql/process
  env
  [`(gql.Mutation/createComputingDeviceAsset {:input {:name "CoolName" :asset_type computing_device}})])
And, this, do not.
(p.eql/process
  env
  [{`(gql.Mutation/createComputingDeviceAsset {:input {:name "CoolName" :asset_type "computing_device"}})
    [:gql.ComputingDeviceAsset/name]}])

Tyler Nisonoff19:01:28

ahhh thanks for updating here, will be helpful for me when I try 😄

wilkerlucio00:01:01

@U0EFQAS4B I just stopped to have a look, but seems like you got it figured out, is there still any issue blocking you?

grant00:01:00

No, no blockers at the moment. I am able to move forward with my patched version of the library and calling the mutations as described.

wilkerlucio00:01:40

patched pathom3-graphql? or something in your end?

grant00:01:03

pathom3-graphql I had to fix it to be able to call p.gql/connect-graphql without crashing. But it’s more a hack to get it working that a real fix.

grant00:01:17

Happy to send it to you if you want it though.

wilkerlucio00:01:13

sure, I would like to see, happy to check a PR, and we can work together on the real fix, I like to see what you had to change

👍 1