From 6ee9d668cd643a4ee710ea51eafeb39f625ff265 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 14 Mar 2017 22:04:34 +0100 Subject: [PATCH] Set proper order on page creation. --- frontend/src/uxbox/main/data/pages.cljs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/frontend/src/uxbox/main/data/pages.cljs b/frontend/src/uxbox/main/data/pages.cljs index 933a479c2..db7fd304c 100644 --- a/frontend/src/uxbox/main/data/pages.cljs +++ b/frontend/src/uxbox/main/data/pages.cljs @@ -198,6 +198,8 @@ ;; --- Create Page +(declare reorder-pages) + (deftype CreatePage [name project width height layout] ptk/WatchEvent (watch [this state s] @@ -207,18 +209,24 @@ :metadata {:width width :height height :layout layout - :order 0}}] - (->> (rp/req :create/page params) - (rx/map :payload) - (rx/map page-created))))) + :order -100}}] + (rx/concat + (->> (rp/req :create/page params) + (rx/map :payload) + (rx/map page-created)) + (rx/of (reorder-pages)))))) (s/def ::create-page-event - (s/keys :req-un [::name ::project ::width ::height ::layout])) + (s/keys :req-un [::name + ::project + ::width + ::height + ::layout])) (defn create-page [{:keys [name project width height layout] :as data}] {:pre [(us/valid? ::create-page-event data)]} - (->CreatePage name project width height layout)) + (CreatePage. name project width height layout)) ;; --- Page Persisted