Added identical? optimization to diffing.
This commit is contained in:
parent
e76ded09dd
commit
9211bc8955
1 changed files with 28 additions and 26 deletions
|
@ -586,10 +586,12 @@
|
|||
nil))
|
||||
cur-child)))
|
||||
|
||||
(defn- try-diff [parent vdom cur-dom-node top-level]
|
||||
(defn- try-diff [parent spec vdom cur-dom-node top-level]
|
||||
(let [cur-state (get-element-state cur-dom-node)
|
||||
cur-tag (.-tag cur-state)
|
||||
new-tag (first vdom)]
|
||||
(if (identical? spec (.-element-spec cur-state))
|
||||
cur-dom-node
|
||||
(if (keyword-identical? new-tag cur-tag)
|
||||
(do
|
||||
;(println "diff hit" (first vdom))
|
||||
|
@ -612,7 +614,7 @@
|
|||
cur-dom-node))
|
||||
(do
|
||||
;(println "build hit" (first vdom) (first cur-vdom))
|
||||
(replace-node-completely parent vdom cur-dom-node top-level)))))
|
||||
(replace-node-completely parent vdom cur-dom-node top-level))))))
|
||||
|
||||
(declare bind-child)
|
||||
|
||||
|
@ -633,8 +635,8 @@
|
|||
(if top-level
|
||||
(do
|
||||
;(println "starting diff replace")
|
||||
(try-diff parent new-virtual-dom cur-dom-node top-level))
|
||||
(try-diff parent new-virtual-dom cur-dom-node top-level))
|
||||
(try-diff parent new-elem-spec new-virtual-dom cur-dom-node top-level))
|
||||
(try-diff parent new-elem-spec new-virtual-dom cur-dom-node top-level))
|
||||
|
||||
(replace-node-completely
|
||||
parent new-elem-spec cur-dom-node top-level)))))
|
||||
|
|
Loading…
Reference in a new issue