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