Only update edited recipes if the recipe changed
This commit is contained in:
parent
14427e89d9
commit
07e85a4d30
1 changed files with 6 additions and 2 deletions
|
@ -36,9 +36,13 @@
|
||||||
(condp = [current next]
|
(condp = [current next]
|
||||||
[:editing :waiting] (let [recipe (om/get-props owner)
|
[:editing :waiting] (let [recipe (om/get-props owner)
|
||||||
name (om/get-state owner :name)
|
name (om/get-state owner :name)
|
||||||
|
|
||||||
grubs (om/get-state owner :grubs)]
|
grubs (om/get-state owner :grubs)]
|
||||||
(om/transact! recipe nil #(assoc % :name name :grubs grubs) :local))
|
(when-not (and (= name (:name @recipe))
|
||||||
|
(= grubs (:grubs @recipe)))
|
||||||
|
(om/transact! recipe
|
||||||
|
nil
|
||||||
|
#(assoc % :name name :grubs grubs)
|
||||||
|
:local)))
|
||||||
nil)
|
nil)
|
||||||
(when-not (= current next) (om/set-state! owner :edit-state next))))
|
(when-not (= current next) (om/set-state! owner :edit-state next))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue