Optimization: don't set grub/recipe state if state is unchanged
This commit is contained in:
parent
78d5617356
commit
e14b3d2a29
2 changed files with 7 additions and 4 deletions
|
@ -48,7 +48,8 @@
|
|||
|
||||
om/IWillReceiveProps
|
||||
(will-receive-props [this {:keys [text]}]
|
||||
(om/set-state! owner :grub-text text))
|
||||
(when-not (= (om/get-state owner :grub-text) text)
|
||||
(om/set-state! owner :grub-text text)))
|
||||
|
||||
om/IRenderState
|
||||
(render-state [_ {:keys [edit-state] :as state}]
|
||||
|
|
|
@ -60,9 +60,11 @@
|
|||
:unmounted false}))
|
||||
|
||||
om/IWillReceiveProps
|
||||
(will-receive-props [this next-recipe]
|
||||
(om/set-state! owner :name (:name next-recipe))
|
||||
(om/set-state! owner :grubs (:grubs next-recipe)))
|
||||
(will-receive-props [this {:keys [name grubs]}]
|
||||
(when-not (= (om/get-state owner :name) name)
|
||||
(om/set-state! owner :name name))
|
||||
(when-not (= (om/get-state owner :grubs) grubs)
|
||||
(om/set-state! owner :grubs grubs)))
|
||||
|
||||
om/IRenderState
|
||||
(render-state [this {:keys [edit-state name grubs]}]
|
||||
|
|
Loading…
Reference in a new issue