Fork me on GitHub
#pathom
<
2022-09-13
>
Jakub Holý (HolyJak)20:09:47

Update simplifying my transaction to [(com.example.client.mutations/create-random-thing {:tmpid #fulcro/tempid["08fd736d-d3cc-4270-9980-08534c8bd7a2"]})] makes it work. Perhaps it is just another case of https://github.com/wilkerlucio/pathom3/issues/156 Hello! I am clearly missing something obvious here. I am sending the mutation

[{(com.example.client.mutations/create-random-thing
   {:tmpid #fulcro/tempid["08fd736d-d3cc-4270-9980-08534c8bd7a2"]})
  [:com.wsscode.pathom3.connect.runner/attribute-errors]}]
and getting back
{com.example.client.mutations/create-random-thing
 {:com.wsscode.pathom3.connect.runner/attribute-errors
  {:com.wsscode.pathom3.connect.runner/attribute-errors
   {:com.wsscode.pathom3.error/cause
    :com.wsscode.pathom3.error/attribute-unreachable}}}}
despite having defined
(pco/defmutation create-random-thing [env {:keys [tmpid] :as params}]
  {::pco/op-name 'com.example.client.mutations/create-random-thing
   ;::pco/params [:tempid]
   ::pco/output [:tempids]}
  (println "SERVER: Simulate creating a new thing with real DB id 123" tmpid)
  {:tempids {tmpid 123}})
which I see is called from the println. What am I doing wrong? 🙏

wilkerlucio21:09:49

the issue here is that attribute-errors come after processing, so they are not something you ask in the query (in the sense that the planner will consider something missing), that was the thinking, but you are pointing a case that makes sense, the client will ask for it, as a hack I believe if you just add an (pbir/constantly-resolver ::pcr/attribute-errors nil) it might work, but its no good really, can you please open an issue for that?

wilkerlucio21:09:10

oh, sorry, there is an issue already :man-facepalming:

wilkerlucio21:09:22

thanks for it 🙂

🙏 1
wilkerlucio21:09:36

doing some experiments

wilkerlucio21:09:17

I think the add of the constantly resolve is a fine solution, what I'll do is make that automatic on lenient mode, since there is no point to it on strict mode

wilkerlucio21:09:31

in case you wanna replicate, this is the extra resolver that fixes it:

wilkerlucio21:09:32

(-> (pbir/constantly-resolver :com.wsscode.pathom3.connect.runner/attribute-errors {})
                         (pco/update-config assoc ::pco/op-name (symbol "com.wsscode.pathom3.connect.runner" (str (gensym "attribute-errors")))))

wilkerlucio21:09:48

(I'm doing random name generation just because in case of graph integration I can't have resolver names colliding)

wilkerlucio22:09:11

fixed in main

❤️ 1