This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-20
Channels
- # announcements (42)
- # babashka (70)
- # beginners (152)
- # chlorine-clover (19)
- # cider (14)
- # clj-kondo (23)
- # clojars (15)
- # clojure (86)
- # clojure-denmark (1)
- # clojure-dev (5)
- # clojure-europe (57)
- # clojure-france (145)
- # clojure-hungary (2)
- # clojure-italy (5)
- # clojure-nl (7)
- # clojure-spec (35)
- # clojure-sweden (2)
- # clojure-uk (58)
- # clojurebridge (1)
- # clojured (1)
- # clojurescript (50)
- # core-typed (9)
- # cursive (10)
- # data-science (11)
- # datascript (4)
- # datomic (25)
- # emacs (8)
- # fulcro (49)
- # graalvm (7)
- # graphql (6)
- # joker (1)
- # juxt (2)
- # kaocha (1)
- # off-topic (22)
- # other-lisps (1)
- # pathom (20)
- # re-frame (3)
- # reagent (11)
- # reitit (2)
- # remote-jobs (1)
- # shadow-cljs (44)
- # spacemacs (2)
- # sql (17)
- # tree-sitter (2)
- # vim (8)
- # vrac (2)
Hello, I'm sending params through load!
params but I'm not seeing the params on pathom side uner :ast
any help please?
What am I doing wrong here? I keep getting not-found
errors
(pc/defresolver two-args [_ {:keys [num1 num2]}]
{::pc/input #{:num1 :num2}
::pc/output [:num1Squared :num1PlusNum2]}
{:num1Squared (* num1 num1)
:num1PlusNum2 (+ num1 num2)})
Which I am then trying to use with the following:
(<!! (parser {} [{[:num1 2 :num2 3] [:num1Squared]}]))
To be clear, every time I remove all the num2
references it works perfectly so the problem should be with the additional input
But I feel like you shouldn't use parameters because num1
and num2
are both required by num-args
and thus they should be dependencies (inputs) not parameters
I've also tried this mix of inputs+parameters but I get a "Key must be integer" error
(<!! (parser {} [{([:num1 3] {:pathom/context {:num2 2}})
[:num1PlusNum2]}]))
but my biggest concern is that if I'm passing inputs in as parameters, aren't I circumventing the whole graph thing that pathom has going for it?@brian.rogers check out https://wilkerlucio.github.io/pathom/#_multiple_inputs
I've tried that with this code:
(<!! (parser {} [{'([:num1 3] {:pathom/context {:num2 2}})
[:num1PlusNum2]}]))
however I get not-found
even with thatThat'll teach me to try to reply to people on the go. My bad! Not sure what's wrong with the above code without being able to work at a repl.
@brian.rogers this example looks correct, did you confirmed you have registered the resolver when building the parser?
I'm not really sure what has changed but I've ended up finding a working solution from the docs, then slowly working my way backwards towards my initial attempt until I found what the difference was. I worked my way all the way back and found that there was no difference and no mistakes and my initial attempt worked. Not sure what happened. Gotta love CS lmao
I also have the same error "Key must be an integer" using something like :
(<!! (parser {} [{([:catalogue/id 1] {:where {:a 1}})
[:catalogue/name
:catalogue/status]}])))
Why would a resolver be called without all its inputs? This has been happening fairly often for me, especially when doing deeper queries. I can sometimes 'fix' it by explicitly adding the missing input to the request at the same level, so it doesn't "forget" to get it.
Even stranger in this case I have no problem resolving one item :foo
. When I ask for a different item that requires JUST :foo
, and has no other resolution paths, it takes a different strategy that causes the aforementioned error and fails.
As if, by going one step deeper it loses track of something?