re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
emccue 2021-06-21T00:34:56.188900Z

I would just never have utility event handlers

emccue 2021-06-21T00:35:22.189100Z

the two cases for me would be user initiated dispatch and "external process" initiated dispatch

emccue 2021-06-21T00:36:00.189300Z

so ::user-clicked-submit-form and then, ::form-successfully-submitted. ::form-failed-to-submit

emccue 2021-06-21T00:36:29.189500Z

::user-clicked would be initiated by the user, the other two are initiated by the http goblin that lives outside of pure fp

emccue 2021-06-21T00:36:52.189700Z

if you need a utility form-save, write a function instead

emccue 2021-06-21T00:38:10.189900Z

(defn form-save [db]
  [[:http-xhrio ...info...]]

(rf/reg-event-fx
  ::user-clicked-submit-form
  (fn [{:keys [db]} _]
    {:db (... set loading flag ...)
     :fx (form-save db)}))

emccue 2021-06-21T00:38:12.190100Z

OR

emccue 2021-06-21T00:39:33.190300Z

(defn form-save [db]
  {:db (... set loading flag ...)
   :fx [[:http-xhrio ...info...]]}

(rf/reg-event-fx
  ::user-clicked-submit-form
  (fn [{:keys [db]} _]
    (compose-stuff 
      (constantly {:db (..set something..)})
      form-save)))

emccue 2021-06-21T00:41:49.190600Z

dispatching should be tied to a real thing that happened

Oliver George 2021-06-21T01:09:34.190800Z

Nice. Thanks.