This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-18
Channels
- # announcements (10)
- # babashka (21)
- # beginners (99)
- # biff (66)
- # catalyst (3)
- # cherry (1)
- # cider (11)
- # clojure (38)
- # clojure-austin (3)
- # clojure-dev (23)
- # clojure-europe (21)
- # clojure-hungary (10)
- # clojure-nl (2)
- # clojure-norway (57)
- # clojure-uk (2)
- # clojurescript (9)
- # cursive (6)
- # fulcro (5)
- # hyperfiddle (14)
- # integrant (4)
- # introduce-yourself (3)
- # lsp (24)
- # off-topic (14)
- # reagent (12)
- # reitit (13)
- # releases (8)
- # sci (16)
- # shadow-cljs (8)
- # solo-full-stack (1)
- # spacemacs (5)
- # squint (3)
- # xtdb (14)
Hi all, I’ve been doing a lot of work on Fulcro and RAD this past week building in some more helpers to dynamic stuff. I’d be interested in hearing feedback on any of it. The versions that I’m referring to are:
• Fulcro 3.7.0-SNAPSHOT
• RAD 1.6.0-SHAPSHOT
• RAD SUI Plugin 1.4.0-SNAPSHOT
and the features I’m about to tell you about are coded into the fulcro-rad-demo branch new-rendering.
I mentioned the multimethod rendering a while back, and what I’ve just added is stuff to aid when doing dynamic things. There was already support for creating a component on the fly comp/sc
, form/form
, report/sc-report
, but adding such things to the UI at runtime was not yet implemented (you could make it happen, but you had to write your own code for it).
These new versions fix that, and dynamic-routing
now has support for:
• Adding a target to a router at runtime (at least one static target is still required)
• New dr/route-to!
supports:
◦ Loading a module of code (optional)
◦ Routing by registry key (I suggest using syntax-quoted symbols to prevent circular refs, but to also enable code nav!)
◦ Adding the target to a specific router if it is missing (see auto-add? flag)
And RAD’s routing functions leverage this so you can do it there as well!
So, something like:
(dr/route-to! app {:router MainRouter
:target `com.example.ui.forms/Form
:load-from :forms
:route-params {}})
will load the js for the forms module (if not already loaded), add the Form to the MainRouter as a target, and route to it!
In the Fulcro RAD Demo (new-rendering branch), see the ui namespace (look for routing that uses symbols), shadow-cljs.edn (for the module config) and invoice-forms
.
Love to hear any feedback on the API before I finalize it in stone.https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/lazy.clj could automatically infer the :load-from
from :target
, though it is a macro
oh, that’s a good find, but I think that would put a shadow dependency on things instead of just cljs, and even though I prefer shadow, I try not to force tooling on ppl.