Fork me on GitHub

re-framers! merry xmas and all that! quick question from a Clojure n00b; I see that devcards currently don't play nice with re-frame. I have been researching the various libs, frameworks and tools in clojurescript for a while, and I think re-frame is exactly what I am after. However, devcards, or something similar would be a huge help. My project is essentially a softphone. And being able to build my UI without making/receiving phonecalls would be a huge productivity win, massive in fact! Is devcard support on the way? or an alternative available? or perhaps you can recommend another framework like re-frame that takes me beyond the reagent basics and will work well with devcards?


I haven’t used either myself so I can’t really give any solid recommendations, but you might be interested in


Ok, that's worth a look, I'll check out out, thanks for the tip @U4ZDX466T


I don’t think there’s any significant difference between workspaces and devcards regarding re-frame? Don’t the same problems apply to both?


Thats a good question @U21QNFC5C I guess I'll find out :thinking_face:

🙂 4
Ramon Rios09:12:15

Merry xmas everybody

Ramon Rios10:12:39

Have you tried to put a conditional statement on a event?.

 (fn [{:keys [db]} [_ id]]
   {:db (->> id
             (get (d/customers db))
             (d/set-current db))
    :dispatch [:customer/check-correspondence]}))
I would like to dispatch check-correspondence with a if condition. Is that possible?


(cond-> {:db ...} condition? (assoc :dispatch ...)

Ramon Rios13:12:43

 (fn [{:keys [db]} [_ id]]
  (cond-> {:db (->> id
                    (get (d/customers db))
                    (d/set-current db))}
    ( false? (contains? (d/current db) :policy-correspondence)) (assoc :dispatch [:customer/default-correspondence]))))

Ramon Rios13:12:49

Like this right?


Yeah. A few things though: - {:keys [db]} can be written as {db :db} - a bit shorter, but only if you need just the DB and nothing else - Don't use ->> for getting by ID, use it to thread through collections instead. More details: - Don't do false? unless you need a strict check for false. Just use not.

Ramon Rios13:12:31

What would you do instead of ->>


(let [customer (get (d/customers db) id)] ... (d/set-current db customer))

Ramon Rios16:12:35

Thanks for the tips

👍 4
Ramon Rios17:12:00

 (fn [{:keys [db]} [_ id]]
   (let [customer (get (d/customers db) id)]
     (cond-> {:db (d/set-current db customer)}
       (not ( customer :police-correspondence)) (assoc :dispatch-n [[:customer/item-changed :policy-correspondence "prod-manager"]
                                                                    [:customer/item-changed :invoicing-correspondence "prod-manager"]])))))

Ramon Rios17:12:59

My current code, it would better to call twice a event that does what i want instead of create a brand new. The condition is not working but i'm trying to figure out why.