@internetarchive/collection-browser 4.1.2-alpha1 → 4.1.2-alpha10

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.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "4.1.2-alpha1",
6
+ "version": "4.1.2-alpha10",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -30,10 +30,11 @@
30
30
  "@internetarchive/field-parsers": "^1.0.0",
31
31
  "@internetarchive/histogram-date-range": "^1.4.1",
32
32
  "@internetarchive/ia-dropdown": "^2.0.0",
33
+ "@internetarchive/ia-userlist-settings": "^1.1.3-alpha3",
33
34
  "@internetarchive/iaux-item-metadata": "^1.0.5",
34
35
  "@internetarchive/infinite-scroller": "^1.0.1",
35
36
  "@internetarchive/modal-manager": "^2.0.5",
36
- "@internetarchive/search-service": "^2.7.0",
37
+ "@internetarchive/search-service": "^2.7.1-alpha3",
37
38
  "@internetarchive/shared-resize-observer": "^0.2.0",
38
39
  "@lit/localize": "^0.12.2",
39
40
  "dompurify": "^3.2.4",
package/src/app-root.ts CHANGED
@@ -510,7 +510,10 @@ export class AppRoot extends LitElement {
510
510
  .loggedIn=${this.loggedIn}
511
511
  .modalManager=${this.modalManager}
512
512
  .analyticsHandler=${this.analyticsHandler}
513
- .pageContext=${'search'}
513
+ .pageContext=${'profile'}
514
+ .pageType=${'account_details'}
515
+ .pageTarget=${'fav-neeraj_archive341'}
516
+ .profileElement=${'favorites'}
514
517
  @visiblePageChanged=${this.visiblePageChanged}
515
518
  @baseQueryChanged=${this.baseQueryChanged}
516
519
  @searchTypeChanged=${this.searchTypeChanged}
@@ -860,10 +860,7 @@ export class CollectionBrowser
860
860
  let sortFieldAvailability = defaultSortAvailability;
861
861
 
862
862
  // We adjust the available sort options for a couple of special cases...
863
- if (
864
- this.withinCollection?.startsWith('fav-') ||
865
- (this.profileElement as string) === 'favorites'
866
- ) {
863
+ if (this.withinCollection?.startsWith('fav-') || this.profileElement === 'favorites') {
867
864
  // When viewing a fav- collection or the favorites profile tab,
868
865
  // we include the Date Favorited option as the default
869
866
  sortFieldAvailability = favoritesSortAvailability;
@@ -1641,6 +1638,7 @@ export class CollectionBrowser
1641
1638
  this.addController(this.dataSource);
1642
1639
 
1643
1640
  this.baseQuery = queryState.baseQuery;
1641
+ this.withinProfile = queryState.withinProfile;
1644
1642
  this.profileElement = queryState.profileElement;
1645
1643
  this.searchType = queryState.searchType;
1646
1644
  this.selectedFacets =
@@ -1653,6 +1651,14 @@ export class CollectionBrowser
1653
1651
  this.selectedTitleFilter = queryState.selectedTitleFilter;
1654
1652
  this.selectedCreatorFilter = queryState.selectedCreatorFilter;
1655
1653
 
1654
+ // Apply the correct default sort for the new profile element immediately,
1655
+ // so it is in place before hostUpdate() fires on the data source.
1656
+ // Without this, a stale defaultSortField from a previously-active tab
1657
+ // could be used in the first fetch for the incoming tab.
1658
+ if (this.profileElement) {
1659
+ this.applyDefaultProfileSort();
1660
+ }
1661
+
1656
1662
  this.pagesToRender = this.initialPageNumber;
1657
1663
 
1658
1664
  // We set this flag during the update to prevent the URL state persistence
@@ -1127,7 +1127,7 @@ export class CollectionBrowserDataSource
1127
1127
  this.host.defaultSortField
1128
1128
  ) {
1129
1129
  const sortOption = SORT_OPTIONS[this.host.defaultSortField];
1130
- if (sortOption.searchServiceKey) {
1130
+ if (sortOption.searchServiceKey && sortOption.handledBySearchService) {
1131
1131
  sortParams = [
1132
1132
  {
1133
1133
  field: sortOption.searchServiceKey,
package/src/models.ts CHANGED
@@ -588,6 +588,7 @@ export const defaultProfileElementSorts: Record<
588
588
  reviews: SortField.datereviewed,
589
589
  collections: SortField.datearchived,
590
590
  web_archives: SortField.datearchived,
591
+ favorites: SortField.datefavorited,
591
592
  };
592
593
 
593
594
  /** A union of the fields that permit prefix filtering (e.g., alphabetical filtering) */