Fork me on GitHub
#fulcro
<
2022-01-17
>
njj16:01:58

Hey all! My company is hiring a clojure/clojurescript engineer (US remote). The main product for my team is built with Fulcro. Here’s the job posting, please DM me with any questions. https://jobs.lever.co/peerspace/50a749e9-eaef-4ac9-8209-0a78a7ee7b40.

❤️ 3
sheluchin18:01:34

I'm trying to understand how to use a RAD defsc-container to combine a) a read-only defsc-form and b) a defsc-report for items related to the form item. My current understanding is that I should pass in the item's id as a route parameter but I'm not having much luck getting it to work. Any advice?

tony.kay19:01:13

Did you look at the usages in the demo? Containers are sort of alpha-ish in the sense that they don’t do a ton for you yet…and may never, given that you can always do your own wrappers. The base utilities are there to run reports/forms as standalone components that are not part of routing.

tony.kay19:01:42

The main thing I wanted out of the container concept was to be able to “push up” common controls, like date ranges on reports

tony.kay19:01:50

so you could do dashboards that make sense

tony.kay19:01:01

That’s why controls are normalized by default

sheluchin20:01:19

Yep, I looked at the demo before asking. I believe the only use of containers there is for the Dashboard https://github.com/fulcrologic/fulcro-rad-demo/blob/1ba6973b2a461f2db9d75d7ab0f529432177d278/src/shared/com/example/ui/dashboard.cljc#L15 and from that I couldn't figure out how to pass in an item id for the form and report children to base their query on. Do you recommend skipping containers for such a use case and just using a plain defsc instead? Containers looked like the right thing from the description and I'm trying to familiarize myself with more of RAD so I thought to give 'em a try.

tony.kay20:01:20

I honestly don’t remember 😄 I would use the source myself. I didn’t get around to writing many docs for them. I remember making the controls normalized, and that’s about it.

sheluchin20:01:02

Got it 🙂 I think the docs could use some clarification around the overlap of RO forms and reports, particularly some examples around how make "reports" for single items and how to combine that with a list view of some related items of theirs. I'll see if I can write something small when I get it working correctly. Thanks for your input!

tony.kay20:01:03

So, there are some additional support functions that might be useful in many cases, and some may not yet exist. So, you should definitely treat the code of form and report as “examples of how to roll your own thing”. I don’t intend entire apps to be written solely with RAD, mainly back-end/admin/simple screens. Once you get the hang of using Pathom properly and see how adding a state machine can lead to dramatic code reuse, you’ve essentially “got it”. I try to use report/form wherever I can in my own prod apps, and it works out more often than not, but as soon as you want to combine many things on screen at the same time you are firmly outside of the “included” features.

tony.kay20:01:28

Combining a report/form on the same screen is partially done in containers, and that should kind of give you ideas of how you could roll your own from there