Fork me on GitHub
#pathom
<
2019-12-17
>
Danny Almeida01:12:37

i've tried the example..but when i enter this query [(::instruments {:sort :instrument/brand})]in the REPL it gives me an error

Danny Almeida01:12:31

any idea what I might be doing wrong

wilkerlucio02:12:53

hello @dionysius.almeida, welcome ๐Ÿ™‚, strange, I just tried that and it worked here, are you getting it consistently?

Danny Almeida02:12:47

I'm trying it in a clojure repl

Danny Almeida02:12:54

not on the web page..where it works fine

Danny Almeida02:12:58

(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))}))

Danny Almeida02:12:32

and followed by (<!! (parser {} [(::instrumentlist {:sort :instrument/brand})]

Danny Almeida02:12:18

#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]}] ~

Danny Almeida02:12:24

That's the error message I get

thosmos05:12:09

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?

wilkerlucio05:12:31

@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})]

wilkerlucio05:12:21

@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

Danny Almeida05:12:52

oh i see...thank you. I'm still new to pathom..just started reading the docs today as part of learning Fulcro ๐Ÿ™‚

๐Ÿ‘ 4
thosmos05:12:27

@wilkerlucio is that related to the trace option I see in fulcro 3?

wilkerlucio05:12:01

no, I don't think so

wilkerlucio05:12:11

the question on metadata over the wire is purely a transit thing

wilkerlucio05:12:28

which trace option are you talking about?

thosmos05:12:02

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

thosmos05:12:39

is there a code example of the metadata on client/server sides that I can see?

thosmos05:12:12

I think I see where to config transit on the server side, currently looking at the Fulcro3 client side aspect

Danny Almeida05:12:28

@wilkerlucio That worked! Thanks again ๐Ÿ‘:skin-tone-3:

thosmos05:12:23

ok, I think I see where to make the changes. thanks!