This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-17
Channels
- # adventofcode (23)
- # announcements (2)
- # aws (11)
- # babashka (181)
- # beginners (59)
- # chestnut (2)
- # clj-kondo (9)
- # clojure (90)
- # clojure-brasil (2)
- # clojure-europe (18)
- # clojure-italy (24)
- # clojure-nl (9)
- # clojure-spec (3)
- # clojure-uk (28)
- # clojured (4)
- # clojuredesign-podcast (3)
- # clojurescript (12)
- # community-development (49)
- # core-async (49)
- # cryogen (5)
- # cursive (16)
- # data-science (1)
- # datascript (7)
- # datomic (54)
- # defnpodcast (4)
- # events (2)
- # figwheel-main (14)
- # fulcro (139)
- # graphql (1)
- # jobs-discuss (6)
- # kaocha (1)
- # luminus (2)
- # malli (3)
- # music (1)
- # off-topic (34)
- # pathom (24)
- # re-frame (13)
- # reitit (5)
- # shadow-cljs (8)
- # test-check (6)
I'm trying pathom documentation ...https://wilkerlucio.github.io/pathom/v2/pathom/2.2.0/connect/resolvers.html#_parameters
i've tried the example..but when i enter this query [(::instruments {:sort :instrument/brand})]
in the REPL it gives me an error
any idea what I might be doing wrong
hello @dionysius.almeida, welcome ๐, strange, I just tried that and it worked here, are you getting it consistently?
yes...
I'm trying it in a clojure repl
not on the web page..where it works fine
(def instruments [{:instrument/id 2,
:instrument/brand "Tajima",
:instrument/type :instrument.type/ukulele,
:instrument/price 50}
{:instrument/id 4,
:instrument/brand "Cassio",
:instrument/type :instrument.type/piano,
:instrument/price 160}
{:instrument/id 3,
:instrument/brand "Ibanez",
:instrument/type :instrument.type/bass,
:instrument/price 270}
{:instrument/id 1,
:instrument/brand "Fender",
:instrument/type :instrument.type/guitar,
:instrument/price 300}])
(pc/defresolver instruments-list [env _]
{::pc/output [{::instrumentlist [:instrument/id :instrument/brand
:instrument/type
:instrument/price]}]}
(let [{:keys [sort]} (-> env :ast :params)]
{::instrumentlist (cond->> instruments
(keyword? sort) (sort-by sort))}))
and followed by (<!! (parser {} [(::instrumentlist {:sort :instrument/brand})]
#error {
:cause "Invalid expression "
:data {:type :error/invalid-expression}
:via
[{:type clojure.lang.ExceptionInfo
:message "Invalid expression "
:data {:type :error/invalid-expression}
:at [com.wsscode.pathom.parser$expr__GT_ast invokeStatic "parser.cljc" 100]}]
~
That's the error message I get
Is it possible to send metadata across the wire? OR how do you handle sending the result count of a query (before limit and offset)? Do you do a second meta query with no keys and a limit of 0 just to get the total count?
@dionysius.almeida the issue is that you not escaping the call to the parser, so its invoking the keyword on that map, you need to use: (<!! (parser {} ['(::instrumentlist {:sort :instrument/brand})]
@thosmos yes, you just need to setup transit so it send it, I have a use case for that were we track which components are spending time of the query fragments
oh i see...thank you. I'm still new to pathom..just started reading the docs today as part of learning Fulcro ๐
@wilkerlucio is that related to the trace option I see in fulcro 3?
no, I don't think so
the question on metadata over the wire is purely a transit thing
which trace option are you talking about?
oh thereโs something in fulcro inspect that can be turned on by running the build with a -Dtrace option and it adds some stuff to the queries
I think I see where to config transit on the server side, currently looking at the Fulcro3 client side aspect
@wilkerlucio That worked! Thanks again ๐:skin-tone-3: