Fork me on GitHub
#fulcro
<
2021-12-20
>
roklenarcic08:12:57

I’ve noticed that in developer’s guide it says to use keyframe renderer 2, but I haven’t found the setting where you specify the renderer

Piotr Roterski08:12:57

@U66G3SGP5 you can do it by passing a renderer under :optimized-render! key to app/fulcro-app when starting the app:

(ns example
   (:require
     [com.fulcrologic.fulcro.rendering.multiple-roots-renderer :as mroot]))

(defonce app (app/fulcro-app {:optimized-render! mroot/render!}))
https://book.fulcrologic.com/#_using_fulcro_component_classes_in_vanilla_js_detached_subtrees https://book.fulcrologic.com/#_render_middleware

roklenarcic09:12:01

I am confused, is multiroot renderer same as keyframe2 renderer?

roklenarcic09:12:39

I guess it is

Piotr Roterski10:12:14

no, sorry for implying that - I just copied an example from docs. For keyframe2 you’d need to use com.fulcrologic.fulcro.rendering.keyframe-render2/render!

Jakub Holý (HolyJak)11:12:05

Just use the default

Jakub Holý (HolyJak)11:12:54

multiroot renderer builds on top of keyframe2 renderer and is the default renderer Don't mess with this until you know what you;re doing and have a good reason to 🙂

💯 1
zeitstein14:12:27

Is there a better way to do something like the following?

(let [stuff {:map {:className "class"}
                :dom (dom/span "chidren")}]
     (if span?
       (dom/span (:map stuff) (:dom stuff))
       (dom/li (:map stuff) (:dom stuff))))
The goal is the avoid duplication – simply choose correct dom node type, all else being equal.

Jakub Holý (HolyJak)15:12:35

It's just functions, no magic! ((if span? dom/span dom/li) props kids)

zeitstein15:12:15

Ah, brilliant 🙂 Thanks!

tony.kay16:12:57

Multimethod? Or if they are all standards tags you could just use create-element directly

gratitude 1
Michael W14:12:26

I don't know about better but I use :classes instead of :className so I can add multiples, and I prefer to keep the element maps with the caller, rather than extract them out. It's a little more duplication but later when I want to tweak I can work on each element individually. I found myself splitting out elements to be able to make changes so I just put the config right with the caller now.

(if span?
  (dom/span {:classes ["ui" "centered"]} (dom/span "children"]))
  (dom/li {:classes ["ui" "item"]} (dom/span "children")))

zeitstein15:12:22

Ah, but duplication is precisely what I want to avoid 🙂

Michael W15:12:12

reducing duplication for that 1 block is almost none, you are still having to call :map and :dom on the let var.

zeitstein15:12:01

For this example, sure, but I'm thinking more generally.

Michael W15:12:51

I did that, but I found myself wanting to make changes later like 'hey let's bold this list item' and having to split the config out from the let var anyways.

Michael W17:12:12

I think I found a bug in fulcro-rad-semantic-ui. When I pass a custom button renderer, if I return nil, it skips the button instead of going back to the default. https://github.com/fulcrologic/fulcro-rad-semantic-ui/blob/develop/src/main/com/fulcrologic/rad/rendering/semantic_ui/report.cljc#L43 In the semantic_ui_options it states returning nil should render the default button: https://github.com/fulcrologic/fulcro-rad-semantic-ui/blob/develop/src/main/com/fulcrologic/rad/semantic_ui_options.cljc#L58

Michael W17:12:47

As far as I can tell it never checks for the return value of report-row-button-renderer to know whether it was nil or not. Am I missing something?

tony.kay19:12:48

I don't remember...the docstring might be wrong (might have copied it from elsewhere) or the code could be at fault.

Michael W19:12:31

the docstring is wrong, the semantic-ui renderer does not check the return value of the custom button render function. I have been playing with a local copy trying to make the logic work to match the docstring. When I get it working I'll post a PR.

Michael W22:12:40

PR is posted and working for me.

tony.kay23:12:04

Released in 1.2.3. Thanks

sheluchin19:12:52

I think it would be handy to have a bb.edn in the project root with common project management tasks (managing data stores, viewing configs, building, etc.). Django, for example, is largely centered around a https://docs.djangoproject.com/en/4.0/ref/django-admin/#available-commands command that's used for all kinds of stuff during development. Is there some way to have babashka execute in the context of a running Fulcro application? For example, if I wanted to create a new babashka process to spit out the current config (a la https://docs.djangoproject.com/en/4.0/ref/django-admin/#diffsettingshttps://docs.djangoproject.com/en/4.0/ref/django-admin/#diffsettings)) or application state map, is that possible? Not sure if better to ask in the bb channel :man-shrugging:

Jakub Holý (HolyJak)08:12:47

the only way I can think of is for BB to connect to the app via REPL. Depends on what you mean by "in the context of a running Fulcro application"

sheluchin13:12:40

That sounds about right. Do you know if that's possible, and if so, if there's some part in the docs that would help me do it? I searched around but I can't quite piece it together from what I'm seeing. What I mean by that is giving newly launched bb tasks the ability to eval stuff in the same REPL. For example if I wanted to spit out the current config or to do something like start/stop an application state (that was defined with mount).

Jakub Holý (HolyJak)16:12:52

Bb has nrepl baked in so I suppose you can use the nrepl client part of that. But #babashka might have st more concrete

👍 1
Michael W20:12:24

Anybody that can look at my PR? I know tony is busy and I think my PR is not good enough, I'd rather not bother him to fix this. Having a hard time removing the duplication on the dom element. https://github.com/fulcrologic/fulcro-rad-semantic-ui/pull/22

❤️ 1
Michael W22:12:32

Figured this out, removed the duplication.

tony.kay21:12:45

Fulcro RAD 1.1.0-RC9 released. I found and fixed the long-standing bug that required you to press "Cancel" button on forms twice.

🎉 6