Skip to content

Commit 8e7d167

Browse files
authored
Do not purge ongoing facet requests when resetting pages (#459)
1 parent 3a10a9e commit 8e7d167

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export interface CollectionBrowserDataSourceInterface
156156
reset(): void;
157157

158158
/**
159-
* Resets the data source to its pages.
159+
* Resets the data source's result pages, keeping other state intact.
160160
*/
161161
resetPages(): void;
162162

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,10 @@ export class CollectionBrowserDataSource
258258
if (Object.keys(this.pages).length < this.host.maxPagesToManage) {
259259
this.pages = {};
260260

261-
// Invalidate any fetches in progress
262-
this.fetchesInProgress.clear();
261+
// Invalidate any page fetches in progress (keep facet fetches)
262+
this.fetchesInProgress.forEach(key => {
263+
if (!key.startsWith('facets-')) this.fetchesInProgress.delete(key);
264+
});
263265
this.requestHostUpdate();
264266
}
265267
}
@@ -676,7 +678,7 @@ export class CollectionBrowserDataSource
676678
get facetFetchQueryKey(): string {
677679
const profileKey = `pf;${this.host.withinProfile}--pe;${this.host.profileElement}`;
678680
const pageTarget = this.host.withinCollection ?? profileKey;
679-
return `fq:${this.fullQuery}-pt:${pageTarget}-st:${this.host.searchType}`;
681+
return `facets-fq:${this.fullQuery}-pt:${pageTarget}-st:${this.host.searchType}`;
680682
}
681683

682684
/**

0 commit comments

Comments
 (0)