Comparing version 0.4.2 to 0.4.3
@@ -206,15 +206,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
let oldRoot = oldRootComponentNode.component; | ||
if (newRootComponentNode === oldRootComponentNode) { | ||
return oldElement; | ||
} | ||
if (!oldRoot) { | ||
throw 'Old Component has never been rendered. Replacing with new Component.'; | ||
} | ||
oldRootComponentNode.component = undefined; | ||
newRootComponentNode.component = oldRoot; | ||
let innerOldRoot; | ||
let innerRoot; | ||
if (oldRoot) { | ||
innerOldRoot = Cascade_1.default.peekDirty(oldRoot, 'root'); | ||
innerRoot = oldRoot.update(newRootComponentNode.props, ...newRootComponentNode.children); | ||
} | ||
else { | ||
console.error('Old Component has never been rendered. Replacing with new Component.'); | ||
newRootComponentNode.toComponent(); | ||
innerRoot = Cascade_1.default.peekDirty(newRootComponentNode.component, 'root'); | ||
} | ||
let innerOldRoot = Cascade_1.default.peekDirty(oldRoot, 'root'); | ||
let innerRoot = oldRoot.update(newRootComponentNode.props, ...newRootComponentNode.children); | ||
if (!innerOldRoot) { | ||
@@ -304,2 +301,4 @@ switch (typeof innerRoot) { | ||
} | ||
else if (newRoot === oldRoot) { | ||
} | ||
else { | ||
@@ -306,0 +305,0 @@ var diff = Diff_1.default.compare(oldRoot.children, newRoot.children, compareVirtualNodes); |
{ | ||
"name": "cascade", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "A modern library for creating user interfaces.", | ||
@@ -5,0 +5,0 @@ "author": "Sean Johnson <sjohnson@sjohnsonaz.com>", |
@@ -285,16 +285,16 @@ import Cascade from '../cascade/Cascade'; | ||
let oldRoot = oldRootComponentNode.component; | ||
if (newRootComponentNode === oldRootComponentNode) { | ||
// No diff necessary. We have the exact same Components | ||
return oldElement; | ||
} | ||
if (!oldRoot) { | ||
// This should never happen | ||
throw 'Old Component has never been rendered. Replacing with new Component.'; | ||
} | ||
oldRootComponentNode.component = undefined; | ||
newRootComponentNode.component = oldRoot; | ||
let innerOldRoot; | ||
let innerRoot; | ||
// TODO: Fix this. It should always have a value, but occasionally it doesn't. | ||
if (oldRoot) { | ||
innerOldRoot = Cascade.peekDirty(oldRoot, 'root'); | ||
innerRoot = oldRoot.update(newRootComponentNode.props, ...newRootComponentNode.children); | ||
} else { | ||
console.error('Old Component has never been rendered. Replacing with new Component.'); | ||
newRootComponentNode.toComponent(); | ||
innerRoot = Cascade.peekDirty(newRootComponentNode.component, 'root'); | ||
} | ||
let innerOldRoot = Cascade.peekDirty(oldRoot, 'root'); | ||
let innerRoot = oldRoot.update(newRootComponentNode.props, ...newRootComponentNode.children); | ||
@@ -401,2 +401,4 @@ if (!innerOldRoot) { | ||
oldElement = newRoot.toNode(namespace); | ||
} else if (newRoot === oldRoot) { | ||
// No diff necessary. We have the exact same VirtualNodes | ||
} else { | ||
@@ -403,0 +405,0 @@ // Old and New Roots match |
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
387967