Fork me on GitHub
#fulcro
<
2023-08-22
>
tony.kay00:08:01

Anyone tracking RAD: I’m working on a new way of defining renderers. Starting with forms. I’m trying out multimethods with hierarchies, and it is looking pretty good to me so far. The API is NOT stable, so don’t use it in production yet, but I’d love some feedback. RAD version 1.6.0-SNAPSHOT, and the book has a new chapter: https://book.fulcrologic.com/RAD.html#MultimethodRender

❤️ 9
Jakub Holý (HolyJak)18:09:45

Fascinating! I'll have a look

tony.kay00:08:39

@holyjak @genekim you might have special interest in these

fappy19:08:31

hi 🙂 Possibly silly question … I see how to use com.fulcrologic.fulcro.server.config on the server side. Is there a way to make config values available to .cljs client code? …. And if config is available on the client side, would that expose secret values? Looking for an example

souenzzo09:08:14

I like to add my "env"/"config" in a dataset, usually on body In fulcro code, somewhere around here https://github.com/fulcrologic/fulcro-rad-demo/blob/main/src/shared/com/example/components/ring_middleware.clj#L28 you add [:body {:data-env (write-transit-str {:my-config :ok :my-secret "abc"})} ... using:

(defn write-transit-str  [x]
  (str (with-open [out (ByteArrayOutputStream.)]
         (t/write (t/writer out :json) x)
         out)))
Then, on client init, you do (app/fulcro-app {:shared (-> document .-body .-datasetEnv read-transit-str)})

👀 2
gratitude-thank-you 2
tony.kay15:08:15

I usually just make a resolver. If it is private data I make it require a session. To avoid exposing real secret values I’ll make the resolver return just a “UI” portion of the config file. E.g.: in defaults.edn

{:ui/config {...}}
then in a resolver:
(defresolver ui-config-resolver [env input]
 {::pc/output [:application/config]}
 {:application/config (:ui/config config)})
and load that at startup

tony.kay16:08:30

or make that resolver a bit more complex and pull out and merge together the bits that I need in the UI.

gratitude-thank-you 2