@@ -149,18 +149,11 @@ export class CollectionBrowserDataSource
149149 */
150150 queryErrorMessage ?: string ;
151151
152- /**
153- * Internal property to store the `resolve` function for the most recent
154- * `initialSearchComplete` promise, allowing us to resolve it at the appropriate time.
155- */
156- private _initialSearchCompleteResolver ! : ( val : boolean ) => void ;
157-
158152 /**
159153 * Internal property to store the private value backing the `initialSearchComplete` getter.
160154 */
161- private _initialSearchCompletePromise : Promise < boolean > = new Promise ( res => {
162- this . _initialSearchCompleteResolver = res ;
163- } ) ;
155+ private _initialSearchCompletePromise : Promise < boolean > =
156+ Promise . resolve ( true ) ;
164157
165158 /**
166159 * @inheritdoc
@@ -205,10 +198,9 @@ export class CollectionBrowserDataSource
205198
206199 // We should only reset if either:
207200 // (a) our state permits a valid search, or
208- // (b) we have a blank query that we want to show empty results for
209- const shouldShowEmptyQueryResults =
210- this . host . clearResultsOnEmptyQuery && this . host . baseQuery === '' ;
211- if ( ! ( this . canPerformSearch || shouldShowEmptyQueryResults ) ) return ;
201+ // (b) we have a blank query that we're showing a placeholder/message for
202+ const queryIsEmpty = ! this . host . baseQuery ;
203+ if ( ! ( this . canPerformSearch || queryIsEmpty ) ) return ;
212204
213205 if ( this . activeOnHost ) this . host . emitQueryStateChanged ( ) ;
214206 this . handleQueryChange ( ) ;
@@ -238,6 +230,7 @@ export class CollectionBrowserDataSource
238230 this . yearHistogramAggregation = undefined ;
239231 this . pageElements = undefined ;
240232 this . parentCollections = [ ] ;
233+ this . previousQueryKey = '' ;
241234 this . queryErrorMessage = undefined ;
242235
243236 this . offset = 0 ;
@@ -382,8 +375,9 @@ export class CollectionBrowserDataSource
382375 this . reset ( ) ;
383376
384377 // Reset the `initialSearchComplete` promise with a new value for the imminent search
378+ let initialSearchCompleteResolver : ( value : boolean ) => void ;
385379 this . _initialSearchCompletePromise = new Promise ( res => {
386- this . _initialSearchCompleteResolver = res ;
380+ initialSearchCompleteResolver = res ;
387381 } ) ;
388382
389383 // Fire the initial page & facet requests
@@ -394,7 +388,7 @@ export class CollectionBrowserDataSource
394388 ] ) ;
395389
396390 // Resolve the `initialSearchComplete` promise for this search
397- this . _initialSearchCompleteResolver ( true ) ;
391+ initialSearchCompleteResolver ! ( true ) ;
398392 }
399393
400394 /**
0 commit comments