Fork me on GitHub
Jakub Holý (HolyJak)09:03:20

Does Fulcro/Transit not support BigDecimals? When I send 123Mfrom 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]


(transit handler)

Jakub Holý (HolyJak)12:03:33

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 that

Jakub Holý (HolyJak)14:03:53

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 🙂

👍 4
Jakub Holý (HolyJak)12:03:49

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.

Jakub Holý (HolyJak)13:03:03

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)

Jakub Holý (HolyJak)14:03:24

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:

Jakub Holý (HolyJak)15:03:09

which version do you use? I am on commit 87b53c8 (2d ago) and it works just fine.

Jakub Holý (HolyJak)15:03:00

and if you try the same as me?


I’ll give it a try - pls give me a few mins…


87b53c8 is working on my machine. Thanks @U0522TWDA

👍 4
Jakub Holý (HolyJak)16:03:14

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.


I’ve literally done ilke 3 days of work on reports…they are very very young


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


Latest SNAPSHOT technically supports both, but I have no demo of that yet.


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.


well, no, the query building will have to be augmented for that.


Good use-case though, I should add that to the TODO list

Jakub Holý (HolyJak)16:03:33

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.


Oh, you’re trying to show the invoice as a report?


That’s still a nested report, which isn’t supported yet…the hooks just aren’t designed yet

👍 4

The best you could do is write a form, and mark all of the field “read only”…i.e. InvoiceDisplayForm.


that has layout options and everything, and supports nesting.


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

Jakub Holý (HolyJak)17:03:05

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)

👍 8

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:

  "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?


mutations are not supported in the query tab


Cool. Thanks!


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?


@danvingo add :target [:list-component] to your load


ah thank you!


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


you could put it in initial state


(fs/add-form-config Cls (get-initial-state Cls {}))


I think that’s what you’re asking


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.


I usually just write the root in these cases so I’m in control


you could also do it as a mutation in the app-did-mount thingy


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