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?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?Use the :fx
effect that accepts a vector of effects that are executed in order. It's documented.
@ps @p-himik https://day8.github.io/re-frame/api-builtin-effects/#fxl
@p-himik @mikethompson thanks