Fork me on GitHub
#fulcro
<
2023-09-25
>
mxfan10:09:16

I have a resolver: #?(:clj (defresolver all-itineraries-resolver [env params] {::pc/output [{:itinerary/all-itineraries [:itinerary/id {:itinerary/destination-city [:city/city-name]}]}]} {:itinerary/all-itineraries (get-all-itineraries env params)})) which when I run a report gives me a query: [({:itinerary/all-itineraries [:itinerary/id :itinerary/date {:itinerary/destination-city [:city/city-name]} :itinerary/raw-price :itinerary/formatted-price]})] with results: {:itinerary/all-itineraries [{:itinerary/raw-price 167, :itinerary/formatted-price "$167", :itinerary/id #uuid "018acbc2-e4b6-8aaa-807e-c86a735d1202", :itinerary/destination-city {:city/city-name "London"}, :itinerary/date #inst "2023-09-26T00:00:00.000-00:00"} {:itinerary/raw-price 402.99, :itinerary/formatted-price "$403", :itinerary/id #uuid "018acbc2-e4b6-8aaa-807e-c86a735d11fd", :itinerary/destination-city {:city/city-name "London"}, :itinerary/date #inst "2023-09-26T00:00:00.000-00:00"} .... How would I display the city-name in the report? Or is there a better way to do this?

mxfan11:09:03

Ok. Found a solution: use a ListItem with

(dom/td  (:city/city-name destination-city))

mxfan11:09:15

So, works like this in a defsc, but how would it work in a defsc-report?

tony.kay12:09:18

Use ro/column-formatter

tony.kay12:09:11

Technically you should also set ro/column-EQL

tony.kay13:09:43

Or you could add a virtual attribute to the model that flattens this value up a level, use that on the report, and provide a resolver for it.

JAtkins15:09:05

File: jar:file:/home/circleci/.m2/repository/com/fulcrologic/fulcro-rad/1.5.6/fulcro-rad-1.5.6.jar!/com/fulcrologic/rad/report.cljc
failed to require macro-ns "com.fulcrologic.rad.report", it was required by "com.fulcrologic.rad.report"
Error in phase :compile-syntax-check
RuntimeException: No such var: comp/sc
Looks like sc was removed from comp in the newest rad iterations but report wasn't updated.

1
tony.kay16:09:54

Other way around? sc has not been removed

tony.kay16:09:15

it’s on line 1441 in main

JAtkins16:09:37

I'm not sure, I just saw the error line when upgrading from 1.4.6 to 1.5.6. I

tony.kay16:09:37

you are possibly using too old of a version of Fulcro?

JAtkins16:09:49

*I'll look a bit closer

tony.kay16:09:20

need Fulcro 3.6.6+

JAtkins16:09:36

ahhh my mistake

tony.kay16:09:46

I may have gotten the transitive dep wrong in my POM file

JAtkins16:09:11

I'll give that a go, we import fulcro and I think that overrides the transitive deps

JAtkins16:09:44

yep that was totally the problem - upgrading to fulcro 3.6.6 worked. Sorry! I forgot rad depended on updates fulcro pretty closely

tony.kay16:09:12

I just realized I never documented this feature: https://book.fulcrologic.com/#_shadow_cljs_build_tool_configuration You can turn on HTML source annotations which tell you what line of code emits what DOM element. It’s been there for years, but undocumented 😕

🎉 4
👀 1
genekim21:09:29

This was fantastic when you showed it to me — I’m trying to put this into every one of my projects. So handy! TY!