Correct use of swap!

This commit is contained in:
Nicholas Kariniemi 2014-10-15 21:26:28 +03:00
parent 0bf8344c62
commit e5309fcd69

View file

@ -16,7 +16,7 @@
(defmethod handle-event :diff [{:keys [hash diff states shadow client? state] :as msg}] (defmethod handle-event :diff [{:keys [hash diff states shadow client? state] :as msg}]
(let [history-shadow (sync/get-history-state states hash)] (let [history-shadow (sync/get-history-state states hash)]
(if history-shadow (if history-shadow
(let [new-state (swap! diff/patch-state state diff) (let [new-state (swap! state diff/patch-state diff)
new-states (sync/add-history-state states new-state) new-states (sync/add-history-state states new-state)
new-shadow (diff/patch-state history-shadow diff) new-shadow (diff/patch-state history-shadow diff)
new-diff (diff/diff-states new-shadow new-state) new-diff (diff/diff-states new-shadow new-state)