This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-20
Channels
- # adventofcode (17)
- # announcements (1)
- # aws (1)
- # beginners (102)
- # calva (27)
- # cider (16)
- # clj-commons (34)
- # clj-kondo (33)
- # cljs-dev (5)
- # cljsrn (4)
- # clojure (124)
- # clojure-europe (17)
- # clojure-nl (8)
- # clojure-spec (13)
- # clojure-uk (6)
- # clojurescript (68)
- # datahike (21)
- # datomic (23)
- # emacs (3)
- # fulcro (30)
- # introduce-yourself (6)
- # jobs-discuss (6)
- # lsp (31)
- # nextjournal (3)
- # off-topic (1)
- # other-languages (45)
- # portal (4)
- # re-frame (8)
- # releases (4)
- # shadow-cljs (39)
- # specter (6)
- # tools-build (18)
- # tools-deps (11)
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
@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_middlewareI am confused, is multiroot renderer same as keyframe2 renderer?
I guess it is
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!
Just use the default
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 🙂
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.It's just functions, no magic! ((if span? dom/span dom/li) props kids)
Multimethod? Or if they are all standards tags you could just use create-element directly
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")))
reducing duplication for that 1 block is almost none, you are still having to call :map and :dom on the let var.
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.
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
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?
I don't remember...the docstring might be wrong (might have copied it from elsewhere) or the code could be at fault.
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.
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:
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"
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).
Bb has nrepl baked in so I suppose you can use the nrepl client part of that. But #babashka might have st more concrete
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