Comparing version 0.0.21 to 0.0.22
18
diff.js
@@ -31,7 +31,7 @@ var isArray = require("x-is-array") | ||
if (b == null) { | ||
apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b)) | ||
if (isThunk(a) || isThunk(b)) { | ||
thunks(a, b, patch, index) | ||
} else if (b == null) { | ||
patch[index] = new VPatch(VPatch.REMOVE, a, b) | ||
destroyWidgets(a, patch, index) | ||
} else if (isThunk(a) || isThunk(b)) { | ||
thunks(a, b, patch, index) | ||
} else if (isVNode(b)) { | ||
@@ -149,8 +149,2 @@ if (isVNode(a)) { | ||
} | ||
} else if (!rightNode) { | ||
if (leftNode) { | ||
// Excess nodes in a need to be removed | ||
patch[index] = new VPatch(VPatch.REMOVE, leftNode, null) | ||
destroyWidgets(leftNode, patch, index) | ||
} | ||
} else { | ||
@@ -180,3 +174,3 @@ walk(leftNode, rightNode, patch, index) | ||
} | ||
} else if (isVNode(vNode) && vNode.hasWidgets) { | ||
} else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) { | ||
var children = vNode.children | ||
@@ -194,2 +188,4 @@ var len = children.length | ||
} | ||
} else if (isThunk(vNode)) { | ||
thunks(vNode, null, patch, index) | ||
} | ||
@@ -196,0 +192,0 @@ } |
{ | ||
"name": "vtree", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "a realtime tree diffing algorithm", | ||
@@ -24,4 +24,3 @@ "keywords": [], | ||
"devDependencies": { | ||
"tape": "^2.13.3", | ||
"virtual-dom": "0.0.10" | ||
"tape": "^3.0.3" | ||
}, | ||
@@ -28,0 +27,0 @@ "licenses": [ |
@@ -1,2 +0,1 @@ | ||
require("virtual-dom/test") | ||
require('./handle-thunk.js') |
var version = require("./version") | ||
var isVNode = require("./is-vnode") | ||
var isWidget = require("./is-widget") | ||
var isThunk = require("./is-thunk") | ||
var isVHook = require("./is-vhook") | ||
@@ -21,2 +22,3 @@ | ||
var hasWidgets = false | ||
var hasThunks = false | ||
var descendantHooks = false | ||
@@ -47,2 +49,6 @@ var hooks | ||
if (!hasThunks && child.hasThunks) { | ||
hasThunks = true | ||
} | ||
if (!descendantHooks && (child.hooks || child.descendantHooks)) { | ||
@@ -55,2 +61,4 @@ descendantHooks = true | ||
} | ||
} else if (!hasThunks && isThunk(child)) { | ||
hasThunks = true; | ||
} | ||
@@ -61,2 +69,3 @@ } | ||
this.hasWidgets = hasWidgets | ||
this.hasThunks = hasThunks | ||
this.hooks = hooks | ||
@@ -63,0 +72,0 @@ this.descendantHooks = descendantHooks |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20036
1
557