This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-16
Channels
- # aleph (2)
- # announcements (1)
- # beginners (162)
- # calva (16)
- # cider (37)
- # cljdoc (9)
- # cljs-dev (2)
- # cljsrn (3)
- # clojure (86)
- # clojure-dev (17)
- # clojure-europe (3)
- # clojure-houston (1)
- # clojure-italy (6)
- # clojure-nl (3)
- # clojure-spec (10)
- # clojure-uk (20)
- # clojuredesign-podcast (15)
- # clojurescript (7)
- # data-science (14)
- # datascript (1)
- # datomic (5)
- # emacs (8)
- # figwheel-main (8)
- # fulcro (25)
- # graalvm (1)
- # jobs (10)
- # jobs-discuss (4)
- # keechma (14)
- # leiningen (2)
- # off-topic (31)
- # onyx (1)
- # other-languages (4)
- # pathom (4)
- # pedestal (1)
- # re-frame (20)
- # remote-jobs (4)
- # shadow-cljs (25)
- # sql (6)
- # tools-deps (15)
- # vim (18)
- # xtdb (9)
Before Pathom was around, when doing df/load
, one of the options you could set was :params
. Not sure the equivalent with Pathom as the way I've got it set up it is a :parser
(in one of the wrap-api
keys), and as such only receives queries. I know that queries can have parameters, but then df/load!
constructs your query for you from a component's query. How should I get a parameter across to Pathom so that it is injected into the graph, as if there was a global resolver for the value of the keyword I want to send across?
@cjmurphy (-> env :ast :params)
should have the params from load!
. The top-level key that starts the query will be where the params appear. E.g. (load! :x ... {:params ...})
will have params in the resolver for :x
The way I've setup the middleware, there's only one thing that can be in the Pathom parser's env, and that's a thing called db-q
. Looks like I need to read the docs to set up Pathom so it is more integrated with Fulcro...
Thanks - I'll try the standard way. Looks like what I want to follow is in the docs at: http://book.fulcrologic.com/fulcro3/#_example_securing_a_normal_remote
The wrap-api in the above code is from com.fulcrologic.fulcro.server.api-middleware
, so is already calling handle-api-request
. But I did notice that the params passed were appearing in the query. So for the call on the client of (df/load! @mount/app [:bank-line/id 1] ui/Unmatched {:params {:customer/kw root/our-customer}})
, the params appear in the query at (-> query first second)
. So for now I'm putting that in the Pathom parser's env.
pathom should be passing the ast node of each query element to its resolver, but the params are only attached to the ident-based one in this case
but yes, if you want them to just be in env as a constant you could pull them out at the top level and put them in env yourself.
as far as I know, that’s for autocomplete/documentation only…it doesn’t prune the query
@cjmurphy params are just for docs as tony pointed out, just make sure you are not hitting this case: https://github.com/wilkerlucio/pathom/issues/93
@wilkerlucio I’ve read the issue, and I don’t understand why the params don’t show in the resolver. You allow for :pathom/context
param, but there is no place else for it to show up:
(eql/query->ast `[({([:person/id 1] {:n 1}) [:username]} {:n 1})])
=>
{:type :root,
:children [{:type :join,
:dispatch-key :person/id,
:key [:person/id 1],
:params {:n 1},
:query [:username],
:children [{:type :prop, :dispatch-key :username, :key :username}]}]}
is that just an oversight in pathom ident reader, and if so, why not add that to the reader as a default behavior?
@tony.kay the problem is the place were the params are been sent, in this example, the params are sent to the ident query [:person/id 1]
, if you look for params while processing it (which is the ident-reader
) you will get the params, but a resolver will run against :username
, which doesn't have any params
that's why @fatihict end up using load-field
, because then the param goes in the field itself instead of the ident join, makes sense?
@tony.kay to clarify, there are no resolvers involved in ident processing, it just forwards that ident as a part of the data for the inner context, to get the params in the previous example you have to have a custom reader
for instead of the default pc/open-ident-reader