From 2979ee90a38dbbb0b197c9e4414cc6a9207ba333 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 29 Sep 2015 14:59:49 -0700 Subject: [PATCH] Revert "[Search] Don't trigger digest cycles while indexing" This reverts commit 4b8a5ac0b257737ee33effc966816afca6c11b94. Performance measurements indicates this is harmful for performance, although this is not well-explained. --- .../search/src/services/GenericSearchProvider.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index e05b58ca96..a8e7976c31 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -126,13 +126,23 @@ 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(indexItems); - }, 0, false); + node.useCapability('composition').then(function (children) { + $timeout(function () { + // ... then index the children + if (children.constructor === Array) { + indexItems(children); + } else { + indexItems([children]); + } + }, 0); + }); + }, 0); } }); }