Fork me on GitHub
#pathom
<
2023-02-01
>
Hukka06:02:41

I haven't followed https://github.com/wilkerlucio/pathom3/projects/1 to see how quickly it gets new things, but after this week release there doesn't seem to be much to do for Pathom3 anymore. Is it getting close to ready?

wilkerlucio11:02:10

hello Tomi! yes, we are getting there! the API has been stable for a while, although Im gonna have a few breaking changes in the next release (on the placeholders entity data feature, see: https://github.com/wilkerlucio/pathom3/issues/187), the good news is that I'm doing it now to prepare to leave the alpha state. fully ready is probably never going to be. one feature that will prob need more development is the foreign parsers, they have their complexities and not many people AFAIK are trying it, so there is likely to be bugs there. but on the rest things seem to be running smoothly

😍 2
Hukka11:02:48

That one already has a PR too; are there other looming breaking changes?

wilkerlucio11:02:09

this one was merged yesterday, but pretty minor, only if you are using the ::p.error/missing-output error cause for some special treatment you will be affected: https://github.com/wilkerlucio/pathom3/issues/149

jeroenvandijk13:02:56

FYI, people that use Pathom with core.cache might want to look into https://ask.clojure.org/index.php/12567/multi-threaded-cache-stampede-in-core-cache, I see the https://pathom3.wsscode.com/docs/cache/#using-corecache would be vulnerable to the same issue (cache stampede)

jeroenvandijk13:02:33

I believe the fix is not hard, but I cannot fully confirm it as I haven’t used the core.cache.wrapped myself yet. Conceptually I’m pretty sure it is not hard to work around it though

wilkerlucio13:02:40

that is great to know!

jeroenvandijk13:02:33

This is how I would solve it (and how I have been working without the wrapped namespace) https://ask.clojure.org/index.php/12567/multi-threaded-cache-stampede-in-core-cache?show=12570#a12570

👍 2
Jakub HolĂ˝ (HolyJak)22:02:19

Hello! How do I prevent exceptions in processor responses, as in > {my-mutation {:com.wsscode.pathom3.connect.runner/mutation-error #error { > :cause “Mutation my-mutation not found” ..}} ? This is a problem b/c Transit screams when it tries to serialize an Exception. I have https://github.com/fulcrologic/fulcro-rad/blob/ba17f5d3057a18e4af77294fc59b9408451896cd/src/main/com/fulcrologic/rad/pathom3.clj#L82-L93 ::pcr/wrap-mutate that should catch an exception and return data instead but obviously it doesn’t work. Thank you for any tips!

wilkerlucio22:02:11

you are looking for ::pcr/wrap-mutation-error

wilkerlucio22:02:10

humm, I'm looking close, maybe not, let me try something here

wilkerlucio22:02:31

ok, your code is actually correct, but I found that the not found is an edge case here

👍 2
wilkerlucio22:02:40

because that doesn't go though the wrap-mutate path

wilkerlucio22:02:56

but it can, I got a fix, gonna make some tests and get it out

wilkerlucio22:02:13

my example code:

(p.eql/process
  (-> {:com.wsscode.pathom3.error/lenient-mode? true}
      (pci/register
        [(pco/mutation 'foo2
           {}
           (fn [env params]
             (throw (ex-info "Foi" {}))))])
      (p.plugin/register
        {::p.plugin/id 'err
         ::pcr/wrap-mutate
         (fn [mutate]
           (fn [env params]
             (try
               (mutate env params)
               (catch Throwable err
                 {::pcr/mutation-error (ex-message err)}))))}))
  ['(foo {})
   '(foo2 {})])
; => {foo {:com.wsscode.pathom3.connect.runner/mutation-error "Mutation foo not found"},
; foo2 {:com.wsscode.pathom3.connect.runner/mutation-error "Foi"}}

wilkerlucio22:02:42

fixed in main wait, not merged yet

Jakub HolĂ˝ (HolyJak)16:02:19

That was a lightning fast fix, thank you!