@internetarchive/collection-browser 2.7.14-alpha-webdev7397.2 → 2.7.14-alpha-webdev7397.4

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.
@@ -596,7 +596,7 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
596
596
  * Fetches search results for privileged users when in manage view.
597
597
  *
598
598
  * This method:
599
- * 1. Checks if we're in search context with > 100 results and not currently loading
599
+ * 1. Checks if we're in search context and either haven't loaded results yet, or have already finished loading with > 100 total results
600
600
  * 2. Resets the datasource pagination state
601
601
  * 3. Fetches first page with limit based on maxPagesToManage threshold
602
602
  * 4. Reloads the infinite scroller to display new results
@@ -1058,12 +1058,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1058
1058
  }
1059
1059
  updated(changed) {
1060
1060
  var _a, _b, _c;
1061
- try {
1062
- console.log('c-b updated', '\n' + [...changed.entries()].map(([k, v]) => `${String(k)}: ${JSON.stringify(v)} -> ${JSON.stringify(this[k])}`).join('\n'));
1063
- }
1064
- catch (err) {
1065
- console.error(err);
1066
- }
1067
1061
  if (changed.has('placeholderType') && this.placeholderType === null) {
1068
1062
  if (!this.leftColIntersectionObserver) {
1069
1063
  this.setupLeftColumnScrollListeners();
@@ -1170,7 +1164,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1170
1164
  }
1171
1165
  }
1172
1166
  if (changed.has('isManageView')) {
1173
- console.log('isManageView changed', changed.get('isManageView'), this.isManageView);
1174
1167
  if (this.isManageView) {
1175
1168
  this.displayMode = 'grid';
1176
1169
  this.fetchManageableSearchResults();
@@ -1178,7 +1171,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1178
1171
  else if (this.pageContext === 'search')
1179
1172
  (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
1180
1173
  (_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
1181
- this.emitManageModeChangedEvent();
1174
+ // Only emit change event if changing b/w true & false, not on initial value set.
1175
+ if (changed.get('isManageView') !== undefined) {
1176
+ this.emitManageModeChangedEvent();
1177
+ }
1182
1178
  }
1183
1179
  if (changed.has('resizeObserver')) {
1184
1180
  const oldObserver = changed.get('resizeObserver');
@@ -1699,17 +1695,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1699
1695
  * Fetches search results for privileged users when in manage view.
1700
1696
  *
1701
1697
  * This method:
1702
- * 1. Checks if we're in search context with > 100 results and not currently loading
1698
+ * 1. Checks if we're in search context and either haven't loaded results yet, or have already finished loading with > 100 total results
1703
1699
  * 2. Resets the datasource pagination state
1704
1700
  * 3. Fetches first page with limit based on maxPagesToManage threshold
1705
1701
  * 4. Reloads the infinite scroller to display new results
1706
1702
  */
1707
1703
  fetchManageableSearchResults() {
1708
1704
  var _a;
1709
- console.log('fetchManageableSearchResults', this.pageContext, this.dataSource.totalResults, this.searchResultsLoading);
1705
+ const hasNotLoadedInitialResults = !this.dataSource.totalResults;
1706
+ const hasLoadedWithMoreResultsAvailable = !this.searchResultsLoading && this.dataSource.totalResults > 100;
1710
1707
  if (this.pageContext === 'search' &&
1711
- (this.dataSource.totalResults > 100 && !this.searchResultsLoading ||
1712
- !this.dataSource.totalResults)) {
1708
+ (hasNotLoadedInitialResults || hasLoadedWithMoreResultsAvailable)) {
1713
1709
  this.dataSource.resetPages();
1714
1710
  this.dataSource.fetchPage(1, this.maxPagesToManage);
1715
1711
  (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();