Skip to content

Commit 013133c

Browse files
committed
Simplify algorithm; we already have list of computed deps in effect list.
1 parent 567e464 commit 013133c

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

lib/mixins/property-effects.js

+7-17
Original file line numberDiff line numberDiff line change
@@ -581,30 +581,20 @@ function getComputedOrder(inst) {
581581
function dependencyCounts(inst) {
582582
const infoForComputed = inst[COMPUTE_INFO];
583583
const counts = {};
584+
const computedDeps = inst[TYPES.COMPUTE];
584585
const ready = [];
585586
let total = 0;
587+
// Count dependencies for each computed property
586588
for (let p in infoForComputed) {
587589
const info = infoForComputed[p];
588590
// Be sure to add the method name itself in case of "dynamic functions"
589591
total += counts[p] =
590592
info.args.filter(a => !a.literal).length + (info.dynamicFn ? 1 : 0);
591-
// Add any dependencies that are not themselves computed to the ready queue
592-
info.args.forEach(arg => {
593-
const dep = arg.rootProperty;
594-
// Putting a count of 0 in for ready deps is used for de-duping
595-
if (dep && !infoForComputed[dep] && !(dep in counts)) {
596-
counts[dep] = 0;
597-
ready.push(dep);
598-
}
599-
});
600-
// Add the method name to the ready queue if "dynamic function"
601-
if (info.dynamicFn) {
602-
const dep = info.methodName;
603-
// Putting a count of 0 in for ready deps is used for de-duping
604-
if (dep && !infoForComputed[dep] && !(dep in counts)) {
605-
counts[dep] = 0;
606-
ready.push(dep);
607-
}
593+
}
594+
// Build list of ready properties (that aren't themselves computed)
595+
for (let p in computedDeps) {
596+
if (!infoForComputed[p]) {
597+
ready.push(p);
608598
}
609599
}
610600
return {counts, ready, total};

0 commit comments

Comments
 (0)