This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-25
Channels
- # announcements (9)
- # babashka (38)
- # beginners (41)
- # biff (1)
- # clojure (19)
- # clojure-europe (7)
- # clojure-uk (2)
- # clojurescript (3)
- # code-reviews (30)
- # conjure (4)
- # cursive (8)
- # datomic (32)
- # docker (2)
- # emacs (7)
- # etaoin (2)
- # fulcro (37)
- # graphql (2)
- # jobs (1)
- # jobs-discuss (8)
- # leiningen (10)
- # lsp (36)
- # meander (4)
- # missionary (4)
- # nbb (12)
- # off-topic (1)
- # other-languages (10)
- # pathom (11)
- # re-frame (5)
- # reitit (4)
- # remote-jobs (3)
- # shadow-cljs (13)
- # sql (1)
- # tools-build (4)
- # tools-deps (31)
- # xtdb (2)
I got a resolver in pathom 3 which is correctly parsed and resolved in the repl but the same resolver with the same input doesn't resolve when I parse
it in the definition of a resolver. Could this be a bug?
Can you provide a example, like this one:
(let [;; a resolver
a (pco/resolver `a
{::pco/output [:a]}
(fn [_ _]
{:a 42}))
env (pci/register [a])]
;; that is correctly parsed in parser
(prn (p.eql/process env [:a]))
;; but not when I use the definition
(prn (a {} {})))
Nope not exactly. Sorry if this is unclear.
This works fine:
(parser {} [{[:person/id "id"] [:a/name]}])
But somehow if I use the same in here:
(pco/defresolver test [{:keys [parser] :as env} {:person/keys [id]}]
{::pco/input [:person/id]
::pco/output [:person/test]}
{:person/test
(parser env [{[:person/id id] [:a/name]}])})
It resolves to nothing. The inputs are exactly the same in both cases.I should point out that the test
resolver has ::pco/batch? true
in the real code.
@U0111PVCS8P by running this code
(let [a (pco/resolver `a
{::pco/output [:a]}
(fn [{:keys [parser]} _]
{:a (nil? parser)}))
env (pci/register [a])]
(p.eql/process env [:a]))
=> {:a true}
I can see that there is no :parser
key in the env
pathom3
do no have parser
concept
You should call process explicitly
(pco/defresolver test [env {:person/keys [id]}]
{::pco/input [:person/id]
::pco/output [:person/test]}
{:person/test (p.eql/process env [{[:person/id id] [:a/name]}])})
@U2J4FRT2T Thanks for your answer. Same behavior with p.eql/process
, tho. I think parser
is something fulcro injects.
in the env map:
:parser #function[com.wsscode.pathom3.interface.eql/process]
(pco/defresolver test [{:keys [parser] :as env} {:person/keys [id]}]
{::pco/input [:person/id]
::pco/output [:person/test]}
(try
(println [:start id])
(let [return (parser env [{[:person/id id] [:a/name]}])]
(println [:ok id return])
{:person/test return})
(catch Throwable ex
(println [:fail id ex])
(throw ex))))
I think I’m getting more information if I remove the lenient mode injected by fulcro.
I asked in the fulcro channel as it seems more fulcro than pathom related.
in eql AST what is the difference between :key
and :dispatch-key