[Search] Don't trigger digest cycles while indexing

Avoid triggering digest cycles while indexing;
remove extra call to $timeout
This commit is contained in:
Victor Woeltjen 2015-09-29 12:19:35 -07:00
parent fe8543158e
commit 77c399f2a2

View File

@ -126,23 +126,13 @@ define(
indexItem(node);
indexed[id] = true;
// If this node has children, index those
if (node && node.hasCapability && node.hasCapability('composition')) {
// Make sure that this is async, so doesn't block up page
$timeout(function () {
// Get the children...
node.useCapability('composition').then(function (children) {
$timeout(function () {
// ... then index the children
if (children.constructor === Array) {
indexItems(children);
} else {
indexItems([children]);
}
}, 0);
});
}, 0);
node.useCapability('composition').then(indexItems);
}, 0, false);
}
});
}