Skip to content

Commit 838a050

Browse files
authored
Add target collection's title to collectionTitles map (#425)
1 parent d8072f8 commit 838a050

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/data-source/collection-browser-data-source.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,10 +1029,12 @@ export class CollectionBrowserDataSource
10291029
}
10301030
this.previousQueryKey = pageFetchQueryKey;
10311031

1032+
const { withinCollection, withinProfile } = this.host;
1033+
10321034
let sortParams = this.host.sortParam ? [this.host.sortParam] : [];
10331035
// TODO eventually the PPS should handle these defaults natively
10341036
const isDefaultProfileSort =
1035-
this.host.withinProfile && this.host.selectedSort === SortField.default;
1037+
withinProfile && this.host.selectedSort === SortField.default;
10361038
if (isDefaultProfileSort && this.host.defaultSortField) {
10371039
const sortOption = SORT_OPTIONS[this.host.defaultSortField];
10381040
if (sortOption.searchServiceKey) {
@@ -1097,7 +1099,7 @@ export class CollectionBrowserDataSource
10971099
}
10981100

10991101
this.sessionContext = success.sessionContext;
1100-
if (this.host.withinCollection) {
1102+
if (withinCollection) {
11011103
this.collectionExtraInfo = success.response.collectionExtraInfo;
11021104

11031105
// For collections, we want the UI to respect the default sort option
@@ -1111,7 +1113,7 @@ export class CollectionBrowserDataSource
11111113
this.collectionExtraInfo.public_metadata?.collection ?? []
11121114
);
11131115
}
1114-
} else if (this.host.withinProfile) {
1116+
} else if (withinProfile) {
11151117
this.accountExtraInfo = success.response.accountExtraInfo;
11161118
this.pageElements = success.response.pageElements;
11171119
}
@@ -1124,6 +1126,12 @@ export class CollectionBrowserDataSource
11241126
for (const [id, title] of Object.entries(collectionTitles)) {
11251127
this.collectionTitles.set(id, title);
11261128
}
1129+
1130+
// Also add the target collection's title if available
1131+
const targetTitle = this.collectionExtraInfo?.public_metadata?.title;
1132+
if (withinCollection && targetTitle) {
1133+
this.collectionTitles.set(withinCollection, targetTitle);
1134+
}
11271135
}
11281136

11291137
// Update the data source for each returned page.

0 commit comments

Comments
 (0)