tidy: rename functions to be more descriptive

This commit is contained in:
Sean Hagstrom 2024-03-27 12:47:16 +00:00
parent a6838699e3
commit fb88457194
No known key found for this signature in database
GPG Key ID: 5257FEDF56307320

View File

@ -11,10 +11,10 @@
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn make-callback-sub
(defn make-stateful-callbacks
[state-ratom]
(let [state-ref (atom nil)]
(js/console.log "init make-callback")
(js/console.log "init make-stateful-callbacks")
(let [reaction-sub (reagent.ratom/track!
(fn [state-ratom]
(js/console.log "reagent reaction")
@ -34,12 +34,9 @@
(fn [event]
(callback @state-ref event))))})))
(def bind
(memoize make-callback-sub))
(defn use-bind [state-ratom]
(let [{:keys [factory sub]} (rn/use-memo (fn []
(make-callback-sub state-ratom))
(make-stateful-callbacks state-ratom))
[state-ratom])]
(rn/use-unmount (fn []
(js/console.log "unmount sub")
@ -82,7 +79,7 @@
(reset! message-sub %)
(set-message %)))
callback-state-sub (reagent.ratom/track combine-subs message-sub profile-sub)
act (use-bind callback-state-sub)
bind (use-bind callback-state-sub)
on-message-submit (rn/use-callback (fn []
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:contact.ui/send-contact-request
@ -136,6 +133,6 @@
:button-one-label (i18n/label :t/send-contact-request)
:button-two-props {:accessibility-label :test-button
:customization-color :danger
:on-press (act on-press-test)}
:on-press (bind on-press-test)}
:button-two-label "test"}]]))