From 920bd2db9d6e3432bcfe2dd4ae020ac40fa59d90 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 7 Jul 2017 16:40:48 +0200 Subject: [PATCH] bugfix: component handling --- src/karax.nim | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/karax.nim b/src/karax.nim index a2ef499..ba992d9 100644 --- a/src/karax.nim +++ b/src/karax.nim @@ -167,9 +167,9 @@ proc vnodeToDom(n: VNode; kxi: KaraxInstance): Node = kxi.toFocus = result if not n.style.isNil: applyStyle(result, n.style) -proc same(n: VNode, e: Node): bool = +proc same(n: VNode, e: Node; nesting = 0): bool = if n.kind == VNodeKind.component: - result = same(VComponent(n).expanded, e) + result = same(VComponent(n).expanded, e, nesting+1) elif n.kind == VNodeKind.vthunk or n.kind == VNodeKind.dthunk: # we don't check these for now: result = true @@ -177,10 +177,10 @@ proc same(n: VNode, e: Node): bool = result = true if n.kind != VNodeKind.text: if e.len != n.len: - kout e.len, n.len + kout e.len, n.len, toTag[n.kind], nesting return false for i in 0 ..< n.len: - if not same(n[i], e[i]): return false + if not same(n[i], e[i], nesting+1): return false else: kout toTag[n.kind], e.nodename @@ -298,6 +298,7 @@ proc apply(kxi: KaraxInstance) = for i in 0..