Skip to content

Commit

Permalink
Clear results on empty prop (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
latonv committed Oct 13, 2023
1 parent 8012f84 commit ed3ad59
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/collection-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ export class CollectionBrowser

@property({ type: Boolean }) suppressResultCount = false;

@property({ type: Boolean }) clearResultsOnEmptyQuery = false;

@property({ type: String }) collectionPagePath: string = '/details/';

@property({ type: Object }) collectionInfo?: CollectionExtraInfo;
Expand Down Expand Up @@ -1414,7 +1416,11 @@ export class CollectionBrowser
return;

// If the new state prevents us from updating the search results, don't reset
if (!this.canPerformSearch) return;
if (
!this.canPerformSearch &&
!(this.clearResultsOnEmptyQuery && this.baseQuery === '')
)
return;

this.previousQueryKey = this.pageFetchQueryKey;

Expand Down

0 comments on commit ed3ad59

Please sign in to comment.