Skip to content

Commit ed3ad59

Browse files
authored
Clear results on empty prop (#319)
1 parent 8012f84 commit ed3ad59

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/collection-browser.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ export class CollectionBrowser
131131

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

134+
@property({ type: Boolean }) clearResultsOnEmptyQuery = false;
135+
134136
@property({ type: String }) collectionPagePath: string = '/details/';
135137

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

14161418
// If the new state prevents us from updating the search results, don't reset
1417-
if (!this.canPerformSearch) return;
1419+
if (
1420+
!this.canPerformSearch &&
1421+
!(this.clearResultsOnEmptyQuery && this.baseQuery === '')
1422+
)
1423+
return;
14181424

14191425
this.previousQueryKey = this.pageFetchQueryKey;
14201426

0 commit comments

Comments
 (0)