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
zendevil 2021-03-17T09:03:29.003700Z

I have a question about the order in which effects are executed. Suppose I have a reg-event-fx that’s returning the following map:

{
    :uploader->body [(:video-body cofx) (:_id db)]
    :video->body [(:video-body cofx) (:video db)]
    :thumbnail->body [(:video-body cofx) (:thumbnail db)]
    :title->body [(:video-body cofx) (:title db)]
    :description->body [(:video-body cofx) (:description db)]
    :address->body [(:video-body cofx) (:address db)]
    :date->body [(:video-body cofx) (:date db)]

    :db (assoc db :uploading-progress true
               :upload-error false)
    :http-xhrio {:method :post
                 :progress-handler #(dispatch [:upload-progress %])
                 :uri (str server-uri "/api/upload-video")
                 :body (:video-body cofx)
                 :on-success [:upload-success navigation]
                 :on-failure [:upload-error navigation]
                 :format (json-request-format)
                 :response-format (raw-response-format)}
    }
In what order are the effects executed? Is the order undefined? Is there a way to enforce order?

zendevil 2021-03-17T09:05:19.004300Z

How do I make sure that the effects

:uploader->body [(:video-body cofx) (:_id db)]
    :video->body [(:video-body cofx) (:video db)]
    :thumbnail->body [(:video-body cofx) (:thumbnail db)]
    :title->body [(:video-body cofx) (:title db)]
    :description->body [(:video-body cofx) (:description db)]
    :address->body [(:video-body cofx) (:address db)]
    :date->body [(:video-body cofx) (:date db)]
happen before the http-xhrio request?

p-himik 2021-03-17T09:17:34.004800Z

Use the :fx effect that accepts a vector of effects that are executed in order. It's documented.

zendevil 2021-03-17T12:00:02.005500Z

@p-himik @mikethompson thanks