Optimization: don't reset grub/recipe edit state if unchanged

This commit is contained in:
Nicholas Kariniemi 2014-10-04 23:40:57 +03:00
parent 86bfdf80e4
commit 76074e5b5c
2 changed files with 2 additions and 2 deletions

View file

@ -36,7 +36,7 @@
[:editing :waiting] (let [grub (om/get-props owner)]
(om/transact! grub #(assoc % :text (om/get-state owner :grub-text))))
nil)
(om/set-state! owner :edit-state next)))
(when-not (= current next) (om/set-state! owner :edit-state next))))
(defn view [{:keys [id text completed] :as grub} owner {:keys [remove-ch]}]
(reify

View file

@ -40,7 +40,7 @@
grubs (om/get-state owner :grubs)]
(om/transact! recipe #(assoc % :name name :grubs grubs)))
nil)
(om/set-state! owner :edit-state next)))
(when-not (= current next) (om/set-state! owner :edit-state next))))
(defn num-newlines [str]
(count (re-seq #"\n" str)))