This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-02
Channels
- # announcements (11)
- # aws (3)
- # babashka (34)
- # beginners (20)
- # biff (2)
- # calva (3)
- # cherry (29)
- # cider (6)
- # cljs-dev (9)
- # clojure (124)
- # clojure-europe (12)
- # clojure-norway (5)
- # clojure-uk (2)
- # clojurescript (32)
- # conjure (11)
- # datalevin (1)
- # datomic (16)
- # deps-new (1)
- # etaoin (6)
- # holy-lambda (10)
- # honeysql (28)
- # hyperfiddle (21)
- # jackdaw (2)
- # jobs (2)
- # leiningen (15)
- # missionary (12)
- # off-topic (132)
- # other-languages (1)
- # pathom (13)
- # rdf (10)
- # re-frame (8)
- # reagent (5)
- # releases (1)
- # remote-jobs (4)
- # shadow-cljs (32)
- # tools-deps (6)
- # vim (15)
- # xtdb (24)
I'm a fan of the idea that forms are "processes" instead of "transactions" (see https://www.bikeshed.fm/185), which tends to imply in my mind that even a simple one-field little modal form with no server communication can result in at least 3 re-frame event handlers: begin-form, commit-form, finish-form (eg. "cancel" ... also gets called by commit-form to clean up ephemeral form state or otherwise hide the modal). Do we have any helper libs or good examples to support this pattern? It's fairly straightforward to set up but feels pretty boilerplate and a bit tedious, which got me to wondering.
I have found that clj-statemachine works really well for form state. The whole process can be emulated in a test and then integrated after
yeah I tend to use clj-statecharts or metosin/tilakone (or often just a couple home-brewed fsm functions) elsewhere. I guess what I'm musing about is some way to programmatically derive event handlers from an FSM definition, so it's possible to see the forest for the trees.
For that you can try a naming standard for events. Then the fsm can treat them as a validated output side effect
Hm. Guess I'm expressing myself poorly. I appreciate the rigour of mapping re-frame events to eg. tilakone actions, but that seems to do nothing for the boilerplate-y-ness around the specific domain of a form with eg validations that fire only when dirty, maybe a couple of server-side checks, etc.