Fork me on GitHub
#pathom
<
2019-12-17
>
dionysius.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

dionysius.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?

dionysius.almeida02:12:47

I'm trying it in a clojure repl

dionysius.almeida02:12:54

not on the web page..where it works fine

dionysius.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))}))

dionysius.almeida02:12:32

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

dionysius.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]}] ~

dionysius.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

dionysius.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 πŸ™‚

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

dionysius.almeida05:12:28

@wilkerlucio That worked! Thanks again :+1::skin-tone-3:

thosmos05:12:23

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