This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-07
Channels
- # announcements (2)
- # asami (2)
- # babashka (15)
- # babashka-sci-dev (31)
- # beginners (130)
- # boot (4)
- # cider (5)
- # circleci (12)
- # clj-kondo (10)
- # cljs-dev (8)
- # clojure (7)
- # clojure-czech (14)
- # clojure-europe (19)
- # clojure-france (5)
- # clojure-uk (2)
- # clojured (23)
- # clojurescript (11)
- # conjure (8)
- # datomic (5)
- # emacs (1)
- # etaoin (8)
- # events (2)
- # fulcro (10)
- # graalvm (18)
- # gratitude (1)
- # holy-lambda (16)
- # honeysql (4)
- # introduce-yourself (1)
- # jobs (2)
- # kaocha (3)
- # london-clojurians (1)
- # lsp (53)
- # off-topic (16)
- # other-languages (2)
- # pathom (4)
- # pedestal (3)
- # podcasts-discuss (1)
- # portal (10)
- # re-frame (69)
- # reitit (2)
- # shadow-cljs (11)
- # vim (7)
- # xtdb (29)
Can I transact a mutation without defining it first? Something like (comp/transact! {:remote ...}
?
that would really surprise me
defmutation
is a macro that emits a defmethod (the defmulti is in mutations ns). The transaction processing system calls that multimethod based on symbols in the tx. So, short answer: no.
As an interesting curiosity of when you’d manually write the defmethod
yourself, see the data-fetch
namespace. Loading is actually defined as a mutation, but using defmethod instead of defmutation.
Ok, thank you.
And thanks for Fulcro btw, I find it really awesome 🙂
If you need some extreme level of dynamism you can always pass parameters to a single mutation and have it do an alternate kind of dynamic dispatch. At the very outer extreme you could even pass a lambda (in tx options, which come through in env), but that of course wouldn’t be full-stack compatible. Using that data fetch load mutation as an example, you could even vary the remote that way, which is why data-fetch defines it as a multimethod instead of using the syntactic sugar.