Fork me on GitHub
#clojure-europe
<
2021-07-08
>
dharrigan05:07:39

Good Morning!

👋 6
6
pez06:07:14

I am barely awake, but good morning anyway!

agigao07:07:35

Dealing w/re-frame and going through the documentation a couple of questions left swirling in my head. The problem is the following - receive input , validate and alter the input box according the validation result (style). (I’m using js lib for that, but I guess unnecessary detail). Question: I chained validation to mobile-number-input event but I’m not sure if it’s the right way - how and where should I introduce validate-phone-num function?

(defn validate-phone-num
  [phone-num]
...)

(reg-event-db
 :set-mobile-num-valid-status
 ...)

(reg-event-fx
:event-name
(fn [{:keys [db]} [_ mobile-num]]
  (let [valid? (validate-phone-num mobile-num)
        status (if valid? :success :warning]
    {:db (assoc mobile number
     :fx [[:dispatch [:set-mobile-num-status status]]})

genRaiy14:07:32

I think it's more idiomatic to use reg-fx for :set-mobile-num-valid-status

genRaiy14:07:07

In general I would check simple formatting stuff in the view before triggering an event but I don't know what your doing in that fn

agigao19:07:43

Thanks for response Ray! Well, I eventually implemented this functionality in/using subscriptions/->calculations. I don’t think it did worth bloating the global state w/additional keys.

reefersleep11:07:54

Good morning

reefersleep11:07:34

Parenthood has all sorts of challenges. My boy won't sleep in a pram yet, so when we're out for long, like today, he sleeps on one of us. And my problem right now has been to find an area with shade so that we don't get roasted. It's all flat and no trees in this area, and houses being built, so I'm borrowing the shade of an unbuilt house.

❤️ 33
dominicm11:07:14

He's so smushed against you, very cute 😄

reefersleep15:07:45

I wrapped him as tight as I could!

otfrom13:07:48

smoooooosh

orestis14:07:38

Morning. A COVID outbreak in our daycare means our little one stays with us. Summer started early! I can’t imagine how people with toddlers managed to work from home during the major lockdowns.

otfrom14:07:20

I got to visit with a lot of them on calls. I enjoyed it

otfrom14:07:27

pets are almost as good