From 07e85a4d309722bcc5af1abdec9f9bc0dacc554d Mon Sep 17 00:00:00 2001 From: Nicholas Kariniemi Date: Fri, 10 Oct 2014 20:39:47 +0300 Subject: [PATCH] Only update edited recipes if the recipe changed --- src/cljs/grub/view/recipe.cljs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cljs/grub/view/recipe.cljs b/src/cljs/grub/view/recipe.cljs index 482f055..3a47cd6 100644 --- a/src/cljs/grub/view/recipe.cljs +++ b/src/cljs/grub/view/recipe.cljs @@ -36,9 +36,13 @@ (condp = [current next] [:editing :waiting] (let [recipe (om/get-props owner) name (om/get-state owner :name) - 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) (when-not (= current next) (om/set-state! owner :edit-state next))))