From b37d3a21b7d48eb5112572a4002fc11a78742d2f Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sat, 19 Mar 2016 19:24:47 +0200 Subject: [PATCH] Avoid persist page operation on first workspace loading. --- src/uxbox/state.cljs | 4 +++- src/uxbox/ui/workspace.cljs | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/uxbox/state.cljs b/src/uxbox/state.cljs index cfbd9ee22..0c9e3ebab 100644 --- a/src/uxbox/state.cljs +++ b/src/uxbox/state.cljs @@ -29,4 +29,6 @@ (defn init "Initialize the state materialization." [] - (rx/to-atom stream state)) + (as-> stream $ + (rx/dedupe $) + (rx/to-atom $ state))) diff --git a/src/uxbox/ui/workspace.cljs b/src/uxbox/ui/workspace.cljs index c1a81f09e..d718338fc 100644 --- a/src/uxbox/ui/workspace.cljs +++ b/src/uxbox/ui/workspace.cljs @@ -34,8 +34,9 @@ (l/focus-atom $ st/state))) (defn on-page-change - [page] - (rs/emit! (udp/update-page page))) + [buffer] + (let [page (second buffer)] + (rs/emit! (udp/update-page page)))) (defn subscribe-to-page-changes [pageid] @@ -43,6 +44,7 @@ (rx/from-atom $) (rx/dedupe #(dissoc % :version) $) (rx/debounce 1000 $) + (rx/buffer 2 1 $) (rx/subscribe $ on-page-change #(throw %)))) (defn- workspace-will-mount