Reset state on full sync

This commit is contained in:
Nicholas Kariniemi 2014-10-15 21:22:53 +03:00
parent 96dd93309d
commit 0bf8344c62
2 changed files with 5 additions and 4 deletions

View file

@ -4,7 +4,7 @@
(defn full-sync [state] (defn full-sync [state]
{:type :full-sync {:type :full-sync
:state state}) :full-state state})
(defn diff-msg [diff hash] (defn diff-msg [diff hash]
{:type :diff {:type :diff

View file

@ -37,9 +37,10 @@
{:new-shadow state {:new-shadow state
:out-event (message/full-sync state)})) :out-event (message/full-sync state)}))
(defmethod handle-event :full-sync [{:keys [state states]}] (defmethod handle-event :full-sync [{:keys [full-state states state]}]
{:new-states (sync/new-state state) (reset! state full-state)
:new-shadow state}) {:new-states (sync/new-state full-state)
:new-shadow full-state})
(defmethod handle-event :default [msg] (defmethod handle-event :default [msg]
#+cljs (logs "Unhandled message:" msg) #+cljs (logs "Unhandled message:" msg)