I would just never have utility event handlers
the two cases for me would be user initiated dispatch and "external process" initiated dispatch
so ::user-clicked-submit-form and then, ::form-successfully-submitted. ::form-failed-to-submit
::user-clicked would be initiated by the user, the other two are initiated by the http goblin that lives outside of pure fp
if you need a utility form-save, write a function instead
(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)}))
OR
(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)))
dispatching should be tied to a real thing that happened
Nice. Thanks.