diff --git a/tools/broccoli/diffing-broccoli-plugin.ts b/tools/broccoli/diffing-broccoli-plugin.ts index 4548c1415c..6c9e3bf516 100644 --- a/tools/broccoli/diffing-broccoli-plugin.ts +++ b/tools/broccoli/diffing-broccoli-plugin.ts @@ -74,12 +74,12 @@ class DiffingPluginWrapper implements BroccoliTree { // Otherwise, `this.diffResult` was produced from the output of the // inputTree's rebuild() method, and can be used without being checked. // Set `this.diffResult` to null and return the previously stored value. - if (!tree.diffResult) { - let differ = index === false ? this.treeDiffer : this.treeDiffers[index]; - return differ.diffTree(); - } let diffResult = tree.diffResult; tree.diffResult = null; + if (!diffResult) { + let differ = index === false ? this.treeDiffer : this.treeDiffers[index]; + diffResult = differ.diffTree(); + } return diffResult; }; @@ -93,10 +93,11 @@ class DiffingPluginWrapper implements BroccoliTree { } private maybeStoreDiffResult(value: (DiffResult | void)) { - this.diffResult = value ? (value) : null; + if (!(value instanceof DiffResult)) value = null; + this.diffResult = (value); } - rebuild() { + rebuild(): (Promise| void) { try { let firstRun = !this.initialized; this.init();