@internetarchive/collection-browser 2.7.3 → 2.7.5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -434,6 +434,12 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
434
434
  connectedCallback(): void;
435
435
  disconnectedCallback(): void;
436
436
  handleResize(entry: ResizeObserverEntry): void;
437
+ /**
438
+ * Ensures that if we have new results from the data source that are not yet
439
+ * displayed in the infinite scroller, that they are immediately reflected
440
+ * in the tile count.
441
+ */
442
+ private ensureAvailableTilesDisplayed;
437
443
  /**
438
444
  * Updates the data source with the current state of facet readiness for loading,
439
445
  * so that they will begin to load in at the appropriate time according to the
@@ -1137,6 +1137,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1137
1137
  this.disconnectResizeObserver(oldObserver);
1138
1138
  this.setupResizeObserver();
1139
1139
  }
1140
+ this.ensureAvailableTilesDisplayed();
1140
1141
  }
1141
1142
  connectedCallback() {
1142
1143
  var _a;
@@ -1170,6 +1171,19 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1170
1171
  // Ensure the facet sidebar remains sized correctly
1171
1172
  this.updateLeftColumnHeight();
1172
1173
  }
1174
+ /**
1175
+ * Ensures that if we have new results from the data source that are not yet
1176
+ * displayed in the infinite scroller, that they are immediately reflected
1177
+ * in the tile count.
1178
+ */
1179
+ ensureAvailableTilesDisplayed() {
1180
+ if (this.infiniteScroller &&
1181
+ this.infiniteScroller.itemCount < this.dataSource.size) {
1182
+ this.setTileCount(this.dataSource.endOfDataReached
1183
+ ? this.dataSource.size
1184
+ : this.estimatedTileCount);
1185
+ }
1186
+ }
1173
1187
  /**
1174
1188
  * Updates the data source with the current state of facet readiness for loading,
1175
1189
  * so that they will begin to load in at the appropriate time according to the
@@ -1332,12 +1346,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1332
1346
  var _a;
1333
1347
  // only reset if the query has actually changed
1334
1348
  if (!this.searchService ||
1335
- this.dataSource.pageFetchQueryKey === this.previousQueryKey)
1349
+ this.dataSource.pageFetchQueryKey === this.previousQueryKey) {
1336
1350
  return;
1351
+ }
1337
1352
  // If the new state prevents us from updating the search results, don't reset
1338
- if (!this.dataSource.canPerformSearch &&
1339
- !(this.clearResultsOnEmptyQuery && this.baseQuery === ''))
1353
+ if (this.baseQuery && !this.dataSource.canPerformSearch) {
1340
1354
  return;
1355
+ }
1341
1356
  this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1342
1357
  this.totalResults = undefined;
1343
1358
  this.pagesToRender =