Ah awesome thank you for this I was wondering if Datomic was the right pairing I’ll give this a look!
FYI https://clojurians-log.clojureverse.org/fulcro/2021-02-11
I can highly recommend Crux (https://opencrux.com) for use with fulcro - it would fit for similar use cases as Datomic, but is open source and the team is amazingly nice and responsive if you have any feedback or questions
Oh nice! I tried searching for prior art and didn’t find this. However the link to the gist is broken for me. It also appears that a PR was never created. @adam678 were you still working on this?
Here's the version I have:
$ cat .clj-kondo/hooks/fulcro.clj
(ns hooks.fulcro
""
{:author "Adam Helins"}
(:require
[clj-kondo.hooks-api :as hook]))
(defn defmutation
[{:keys [node]}]
(let [[_call
sym
& arg+] (:children node)
docstring (first arg+)
[[param+
& fn-like+]
docstring-2] (if (hook/string-node? docstring)
[(rest arg+)
docstring]
[arg+
nil])]
{:node (hook/list-node (concat [(hook/token-node 'defn)
sym]
(when docstring-2
[docstring-2])
[param+
(hook/vector-node (map #(let [[_sym
arg+
& body] (:children %)]
(hook/list-node (list* (hook/token-node 'fn)
arg+
body)))
fn-like+))]))}))
Thanks. This is a simpler approach I think. I was under the incorrect assumption that mutation handlers could refer to each other, but that’s not the case (the :dispatch
key in env holds those lambdas).
On the flip side, I could see kondo implementing “unused lambda” lints one day, which would throw false positives with the above.
@cjsauer Hi, here is my original gist: https://gist.github.com/helins/52d03847157b0dc95c6987844a74dd68 The PR slept out of my mind (had to work fast at that time) and I see you have already proposed something. Let me know it goes through, if not we can use that gist 🙂
Thanks, will do :)
Fulcro mentioned in the State of Clojure 2021! https://clojure.org/news/2021/04/06/state-of-clojure-2021 🎉
4👍7❤️16🎉I’ve only used Fulcro with Datomic, so I’m biased. Fulcro’s query syntax was inspired by Datomic’s pull syntax and was originally designed to work directly with it. Pathom made it much easier to integrate with other DBs, but the pairing is still optimal.
@holyjak have you used pathom placeholders with subforms? It seems that add-form-config isn’t finding subforms if my subform is split into placeholders…and struggling to figure out how to get around it
No I haven't :( Please let me know if you figure it out!
Perhaps subforms require that the thing being edited is an entity of its own and not a part of a bigger entity?
i think i’ll have to make a duplicate edge from A to B that doesn’t use pathom placeholders, seems the form state code assumes that any join is going to be flat, it doesn’t know how to walk the placeholder map
Thank you both, Crux looks pretty awesome in general I’ve never heard of it. I’m also wondering does anyone have a good full stack example of fulcro with a backend or template they use. I read the docs but definitely still feel really daunted getting started and would love to poke around with a good starting off point. I’m also new to clojure generally so if fulcro is maybe a tough starting point let me know as well. It just seems like the best option for building a production app though as well.