From 03cf8e982618a403aa8f1869cfff53070d2e1e1a Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 27 Nov 2014 14:47:00 -0500 Subject: [PATCH] Bug fix for issue with diffing child nodes. --- src/clojure/freactive/dom.cljs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/clojure/freactive/dom.cljs b/src/clojure/freactive/dom.cljs index d8a8fae..38d9a73 100644 --- a/src/clojure/freactive/dom.cljs +++ b/src/clojure/freactive/dom.cljs @@ -578,11 +578,12 @@ (if (and (sequential? new-child) (not (keyword? (first new-child)))) (let [cur-child (try-diff-subseq parent cur-child new-child)] (recur cur-child (first more) (rest more))) - (do + (let [next-sib (.-nextSibling cur-child)] (replace-child parent new-child cur-child false) - (recur (.-nextSibling cur-child) (first more) (rest more)))) + (recur next-sib (first more) (rest more)))) (do - (append-children! parent new-children) + (append-child! parent new-child) + (append-children! parent more) nil)) cur-child))) @@ -594,7 +595,7 @@ cur-dom-node (if (keyword-identical? new-tag cur-tag) (do - ;(println "diff hit" (first vdom)) + ;(println "diff hit" (first vdom) (.-id cur-state)) (let [old-attrs (.-attrs cur-state) new-attrs? (second vdom) new-attrs (when (map? new-attrs?) new-attrs?)]