Fork me on GitHub
#fulcro
<
2021-09-15
>
hadils18:09:16

Two questions: 1) How do I incorporate my own queries into a RAD form? 2) What is the best way to load an entity that is just a string or a number (a scalar)??

Jakub Holý (HolyJak)18:09:54

Where do you want to load it? Outside of RAD form/report? Something similar has been discussed recently here. Something like (df/load! app :string-or-number nil) and

(pc/defresolver [_ _]
 {::pc/output [:string-or-number]}
 {:string-or-number 123})

hadils19:09:30

Hi @U0522TWDA. What if I want to do a load inside a RAD form/report?

Jakub Holý (HolyJak)19:09:14

When? Why? I guess the answer is the same Tony gave to Gene recently - modify the default UISM to do it where, when you need it. (This was about reports but applies equally, I am sure https://clojurians.slack.com/archives/C68M60S4F/p1631641523204700?thread_ts=1631640618.203500&amp;cid=C68M60S4F ) Maybe if you explain little more what you are trying to do?

hadils19:09:07

Yes. I have a remote for async JS. I need to load the access token from there to determine which form to go to next.

tony.kay23:09:00

Also remember that defsc-form is just a generated defsc that uses a predefined state machine. It is not meant to be something that always applies or is the best use-case for every possible situation...sometimes you just need a hand-coded solution. That said, you can always sub out the state machine and make it do pretty much whatever you want. The building block are all there. Really defsc-form is more about dealing with persisted data and interactions with a server that persists them. Forms, unlike reports, don't always load something (new entities, for example, are just created locally). So, query inclusions are more about local data (unless you override the UISM and add some kind of loading logic).

hadils00:09:26

Thank you @U0CKQ19AQ. I think I will need a custom defsc.