From 064d0effac0bca923727dbebfd7ca742e51db7aa Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Mon, 8 Jul 2019 10:03:02 -0700 Subject: [PATCH] Simplify algorithm; we already have list of computed deps in effect list. --- lib/mixins/property-effects.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index a07cbfc197..83960e4987 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -581,30 +581,20 @@ function getComputedOrder(inst) { function dependencyCounts(inst) { const infoForComputed = inst[COMPUTE_INFO]; const counts = {}; + const computedDeps = inst[TYPES.COMPUTE]; const ready = []; let total = 0; + // Count dependencies for each computed property for (let p in infoForComputed) { const info = infoForComputed[p]; // Be sure to add the method name itself in case of "dynamic functions" total += counts[p] = info.args.filter(a => !a.literal).length + (info.dynamicFn ? 1 : 0); - // Add any dependencies that are not themselves computed to the ready queue - info.args.forEach(arg => { - const dep = arg.rootProperty; - // Putting a count of 0 in for ready deps is used for de-duping - if (dep && !infoForComputed[dep] && !(dep in counts)) { - counts[dep] = 0; - ready.push(dep); - } - }); - // Add the method name to the ready queue if "dynamic function" - if (info.dynamicFn) { - const dep = info.methodName; - // Putting a count of 0 in for ready deps is used for de-duping - if (dep && !infoForComputed[dep] && !(dep in counts)) { - counts[dep] = 0; - ready.push(dep); - } + } + // Build list of ready properties (that aren't themselves computed) + for (let p in computedDeps) { + if (!infoForComputed[p]) { + ready.push(p); } } return {counts, ready, total};