This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-27
Channels
- # announcements (2)
- # aws (31)
- # babashka (81)
- # beginners (82)
- # calva (38)
- # clj-kondo (41)
- # cljdoc (4)
- # cljs-dev (6)
- # clojure (101)
- # clojure-belgium (1)
- # clojure-europe (30)
- # clojure-germany (1)
- # clojure-italy (7)
- # clojure-nl (4)
- # clojure-norway (1)
- # clojure-spec (1)
- # clojure-uk (19)
- # clojurescript (16)
- # clojutre (1)
- # community-development (26)
- # core-logic (2)
- # data-science (26)
- # datomic (71)
- # events (3)
- # fulcro (55)
- # graalvm (2)
- # graphql (3)
- # joker (2)
- # kaocha (19)
- # luminus (2)
- # malli (6)
- # meander (3)
- # off-topic (6)
- # pathom (34)
- # random (1)
- # re-frame (2)
- # robots (1)
- # shadow-cljs (37)
- # sql (30)
- # tools-deps (21)
- # xtdb (4)
- # yada (25)
Does Fulcro/Transit not support BigDecimals? When I send 123M
from a Pathom resolver, the Inspect - Query view shows the value as #object[UX [TaggedValue: f, 123]]
Or is this OK and will work just fine in the UI?
It's a transit issue. Once JS do not have BigDec, it just decode as a Tagged I usually create a handler that turns BigDec into JS strings]
Thanks! Could you be so kind and share how you do it? Or I can just search for it...
(t/reader :json
{:handlers {"f" (fn [x] (.-rep x))}})
Something like it. Would be nice a blogpost about thatFYI for RAD: http://book.fulcrologic.com/RAD.html#_arbitrary_precision_math_and_storage
Thanks, @UCHV4JZ7A! So when I actually display it in the UI, it will look just fine and I can use the math ns to work with it?
👍 I don’t know, sorry — the extent of my knowledge is that what I sent exists 🙂
Reading the RAD book's docs for ::report/source-attribute
, it seems that the data must be under a top-level key in the DB, right? So I cannot have a list (report) invoices with the action "show invoice rows" that would show another report with the invoice's details, without loading them into a top-level key first?
Actually I have a standard defsc for LatestInvoice and would like to have it display also an on-demand list of the invoice rows. But it is the same problem - I have a parent component that has the data and wants to display them in a report but has to put them under a top key first.
BTW, since I already have all the attributes defined, it would be nice to be able to leverage them also for a single-entity display, ie say this component should display these attributes of account, in the given order, using the default layout (likely a table)
Regarding ::attr/identity?
- what if the DB table has a composed primary key, i.e. it is formed by 2+ columns and there is no single-column id? I guess so far out of scope?
Hi all - I’m exploring the fulcro-rad-demo and compilation with shadow-cljs watch main
fails with a Use of undeclared Var com.fulcrologic.rad.application/install-ui-controls!
error. Any idea what I’m doing wrong? Submitted a bug here: https://github.com/fulcrologic/fulcro-rad-demo/issues/7
which version do you use? I am on commit 87b53c8 (2d ago) and it works just fine.
I’m on https://github.com/fulcrologic/fulcro-rad-demo/commit/6a8cf90997ad851e10a1e23c625f3eeb39ca9ecd pushed 14 hours ago
and if you try the same as me?
I’ll give it a try - pls give me a few mins…
I am trying but failing to find out how to use a Report to show "rows" of a selected item. I have a list (report, actually) of invoices with a "Details" button. When the button is pressed, I want to somehow load rows for the selected invoice and show them in a report.
Reports work fine when the data is at the top level of the DB / there is a pathom resolver for its ::report/source-attribute
but using to show the details of a selected entity escapes me...
You’re trying to embed the details in the row? I.e. line items? That isn’t there yet. Best you can do is link to the invoice itself, as I do in the demo.
Well, actually, there is a way to do it in the current version: Write a custom layout renderer that supports it, and install a custom machine. 🙂
probably don’t need the custom machine, now that I think about it…assuming you’re ok having the line items loaded in advance and just hidden.
Yes and no. I have independent components. When you select an invoice from the list, I hide the list and show the invoice's details including its rows report. So data-wise you could say it is embedded but not physically.
That’s still a nested report, which isn’t supported yet…the hooks just aren’t designed yet
The best you could do is write a form, and mark all of the field “read only”…i.e. InvoiceDisplayForm.
The current report stuff is “tabular report”…what you want is more of a “entity report” that has a design similar to forms. Not sure those will combine nicely into the same concept. I might need to make two kinds of reports. We’ll see. Might just be an option on defsc-report
Having an entity report for the invoice would be nice, as I could reuse the work with attribute definitions. Currently I have a standard defsc for displaying the invoice but inside it I want to include a report with the invoice rows.
To all and @alex-eberts make sure if you try out RAD demo that you use the master branch. develop is in flux and uses snapshot versions that I sometimes forget to publish. I did a bunch of cleanup and normalization yesterday, including moving some things around and renaming some keys. I’ll change the default in GH so no one else makes that mistake. Contributors to the demo should branch FROM develop. Master is always a stable release (if I do things right)
I can run a mutation (both server and broswer -side), and see the network request and response in Fulcro Inspect -> Network. Everything works. However, when I use "Send to query" to send the request to Fulcro Inspect -> Query, and then run the query. The response is:
{fulcro-app.db.mutations/update-team!
{:com.wsscode.pathom.core/reader-error
"Mutation not found - {:mutation fulcro-app.db.mutations/update-team!}"}}
This is the correct namespace. Both clj and cljs mutations exist and work when run in the server and browser. What am I doing wrong?I'm struggling to get a list of data in a component one level down the tree from root. Here's my example:
(defsc Person [this {name :person/name id :person/id}]
{:query [:person/name :person/id]
:ident :person/id}
(dom/div (dom/p "Name: " name)))
(defsc People [this {:keys [all-people]}]
{:query [ {:all-people (comp/get-query Person)}]}
(dom/div "HI all people"))
(def ui-people (comp/factory People))
(defsc Root [this {:keys [list-component all-people]}]
{:query [{:list-component (comp/get-query People)}
{:all-people (comp/get-query Person)}]
:componentDidMount (fn [this] (df/load! this :all-people Person))}
(println "list-component: " list-component) ; <- this is nil
(println "all-people: " all-people) ; <- this has data
(dom/div (ui-people list-component)))
;; After network load, db has:
;; :all-people [[ :person/id #uuid "a097e870-2a91-4497-ae0d-72f7e178c7f1" ]]
;; :person/id {#uuid "a097e870-2a91-4497-ae0d-72f7e178c7f1" {:person/name "test" :person/id #uuid "a097e870-2a91-4497-ae0d-72f7e178c7f1" }}
if i query for all people from the root, the data is resolved, but asking for the data in the People component returns nil.
anyone have an idea of how to get this People query from root to return data?and you don’t need the all-people thjing in your root query. You’re using that as a made-up name for network API…the only thing you need in the UI query is stuff that the UI will use. The confusion comes in when you want both: query for network purposes vs UI, and there is often overlap.
i see now. it clicked after adding the target bit that the list needs to get it's data from somewhere
I have a workspaces card that shows a form, but I don’t know where to put my add-form-config
@roklenarcic not sure what you mean
there is a tree version and a normalized version of that function. The tree version is for cases where you ahve a tree of data, like in initial state
add form config expects to get the root tree, right?
because in workspaces the component of the card is not at root
@roklenarcic You can ask ws to either make a mock root for you, or trust you on the root. add-form-config expects the tree of the form itself.
so, you could make your own root so you can wrap the get initial state…I don’t remember if ws has an option for specifying initial state…I mean, you could pass app options to the card if you’re embedding an app and set initial state manually.
hm OK, I will try it, I got a weird state when I did (fs/add-form-config Cls (comp/get-initial-state Cls….
, so I thought it needed to be root, will investigate further
yeah I was using wrong add-form-config