Skip to content

Commit

Permalink
fix: skip showing "top" values for creator facet
Browse files Browse the repository at this point in the history
  • Loading branch information
aaxelb committed Oct 13, 2023
1 parent c2c4fad commit 8ba6f9b
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,20 @@ export default class FilterFacet extends Component<FilterFacetArgs> {
@tracked hasMoreValueOptions = false;
@tracked nextPageCursor = '';

get shouldShowTopValues() {
return !this.args.property.propertyPathKey.includes('creator');
}

@action
toggleFacet() {
if (this.filterableValues.length === 0 && !taskFor(this.fetchFacetValues).lastComplete) {
taskFor(this.fetchFacetValues).perform();
if (this.shouldShowTopValues) {
if (this.filterableValues.length === 0 && !taskFor(this.fetchFacetValues).lastComplete) {
taskFor(this.fetchFacetValues).perform();
}
this.collapsed = !this.collapsed;
} else {
this.openSeeMoreModal();
}
this.collapsed = !this.collapsed;
}

@action
Expand Down Expand Up @@ -105,8 +113,14 @@ export default class FilterFacet extends Component<FilterFacetArgs> {
@waitFor
async fetchFacetValues() {
const { cardSearchText, cardSearchFilter, property } = this.args;
const { page, sort, filterString } = this;

const { page, sort, filterString, shouldShowTopValues } = this;
if (!shouldShowTopValues && !cardSearchText.trim()) {
this.filterableValues = [];
this.modalValueOptions = [];
this.hasMoreValueOptions = false;
this.nextPageCursor = '';
return; // skip fetching
}
const valueSearch = await this.store.queryRecord('index-value-search', {
cardSearchText,
cardSearchFilter,
Expand Down

0 comments on commit 8ba6f9b

Please sign in to comment.