This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-12
Channels
- # announcements (1)
- # babashka (42)
- # beginners (114)
- # bristol-clojurians (2)
- # calva (7)
- # cider (4)
- # clj-kondo (7)
- # cljs-dev (37)
- # cljsrn (13)
- # clojure (114)
- # clojure-austin (3)
- # clojure-europe (5)
- # clojure-nl (10)
- # clojure-spec (77)
- # clojure-sweden (4)
- # clojure-uk (16)
- # clojurescript (52)
- # conjure (155)
- # core-async (18)
- # cursive (23)
- # datomic (20)
- # duct (2)
- # emacs (13)
- # figwheel (3)
- # figwheel-main (9)
- # fulcro (31)
- # gis (8)
- # helix (33)
- # jobs (12)
- # jobs-discuss (66)
- # kaocha (4)
- # lein-figwheel (1)
- # meander (16)
- # off-topic (5)
- # pathom (13)
- # pedestal (6)
- # quil (6)
- # rdf (17)
- # re-frame (32)
- # reagent (34)
- # reitit (30)
- # remote-jobs (1)
- # ring (2)
- # shadow-cljs (149)
- # spacemacs (1)
- # sql (8)
- # tools-deps (90)
- # xtdb (19)
RAD update: I got most of table groupings fleshed out today. So, the table support to date was purely row-based: you have fixed columns and get n rows from the server. This is great for simple CRUD, but falls way short for many reporting needs. I have two things I’m planning to implement to help solve the wider need: grouping (mostly done, need “rotate” support in UI), and derived rows (still to do, but even more general).
The grouping support allows you to use the same report parameters, but return a single map with rolled up results over some groups. The demo has an example with live resolvers that roll up data from invoices. The short description is that adding ro/grouped-on
causes the report to expect a single result with a vector for each column. These are then transformed into the “rows”. A rotate?
option will be added soon that allows you to treat the columns as rows so you can display the values “across” instead.
Source of interest in the demo:
https://github.com/fulcrologic/fulcro-rad-demo/blob/develop/src/shared/com/example/ui/sales_report.cljc#L76
https://github.com/fulcrologic/fulcro-rad-demo/blob/develop/src/shared/com/example/model/invoice.cljc#L65 (through the end of file)
The data returned from the resolver looks (sorta) like the comment at the bottom of that last file.
This support will also be great for graphical reports, since this format of the data is very often exactly what you need for charts and graphs.
The “derived rows” is also a simple add: the idea is to add a stage to the report (currently it does load -> group (new) -> filter -> sort -> paginate). The derived rows feature will just add a stage to that pipeline that lets you take the raw input rows and convert them to whatever it is you want to use. I need to give it more thought, but it might turn out to be the stage I just added (group) is just a special case of this generalization.
If I am defining mutations under the same namespace for clj and cljs each ex- abc/mutations/sales.clj
and abc/mutations/sales.cljs
. Is this ok or will it lead to conflicts ?
The reason I ask is I only see the cljc
being used and never separate files with same ns for both clj and cljs.
I want to do a pathom query where I can pass multiple params -
this one works -
(parser {} [{[:a/a 1] [:a/name]}])
however this one doesnt -
(parser {} [{[:a/a 1, :a/b 2] [:a/name]}])
How do I pass multiple params to a pathom parser ?
You use :pathom/context to get multiple inputs: https://wilkerlucio.github.io/pathom/#_multiple_inputs
(parser {} [{(account-edge {:pathom/context {:a/b 2}}) efarm/account-id->farms}])
@U0D5RN0S1 the above throws an error key should be an integer
, is the format I am using correct ?
yup the one with backtick does not throw error anymore, however when I print the params from the resolver it still doesnt show the pathom/context vars
(defresolver farms-by-account-id [env {:account/keys [id] :as p}]
{::pc/output [{:farms [:farm/name :farm/id :farm/address :farm/account]}]
::pc/input #{:account/id}}
(prn p)
{:farms (dfarm/get-farms-by-account-id id)})
I am creating a parser using com.fulcrologic.rad.pathom/new-parser, and the it includes the open-ident-reader
by default. So I guess I don have to do anything and the :pathom/context
params should get added automatically to my params ?
They should be added automatically to your input, not your params. In a defresolver the arg after env is input.
Sorry I meant inputs only, I have placed a prn in the input, see my defresolver above. It only prints the ident and not the other pathom/context map.
Your input is only :account/id
. The second input, that you put in :pathom/context
, should also be specified. i.e. the ::pc/input
set should contain 2 keywords.
thanks @U0D5RN0S1 that did the trick, I assumed that the input is only for the resolvers to determine if it can satisfy a given query or not. I thought that everything will get passed in the args irrispectively.
I’m getting longs in the client db (datomic :db/id)
#object[Long 21836300927631454]
I’m guessing it’s needed for transit? So this should be handled in the client? Any smart ways to handle this in the client?
It’s a bit weird though, since the type is long for all :db/ids
{:db/id 34353141298233449} java.lang.Long
{:db/id 3602000092594272} java.lang.Long
But in the pathom response I’m getting
"~i34353141298233449"
3602000092594272
js Number cannot hold bigger longs, so transit converts them to goog Long (only when they would overflow), which works perfectly fine with Fulcro. There is no better solution that I can think of objectively…you could use strings, but that certainly seems subjectively and objectively worse to me.
Ah that makes sense, thanks. Yeah I agree with you. The problem I had was that I kept getting nil for id
:ident :thenamespace/id
:query [:thenamespace/id]
I checked the DB and there was one blue id (number) and others were black (goog Long). Everything worked as expected with the number, so I thought the problem was goog Long. It’s most likely something else I’m doing wrongYeah it’s because of routing and my :will-enter. pushy sets token to entity/id and in :will-enter I used to just parseInt it (autoincrement id). It’s all clear now thanks
cool, yeah routing using strings means if you use real db ids you have to be careful
hi, can I use fulcro with an servlet container like tomcat ? the use case is to integrate with existing application that runs inside a template container. I've searched the docs a bit and the issues and I could not find something related to this.
Fulcro’s libraries are mostly front-end (we specify how server interactions take place, but not the implementation of them on the server), and the back-end is a small bit of Ring middleware mostly using Pathom. Backend can be whatever, including a servlet adapted to Ring