Skip to content

Commit

Permalink
fix optional chaining issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuljain-dev committed Oct 16, 2024
1 parent 31f9897 commit 72cfb20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ui/widgets/nuxeo-selectivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -2435,7 +2435,11 @@ typedArrayTags[weakMapTag] = false;
let resultsHtml = isFilteredResultNotEmpty ? this.renderItems(filteredResults) : '';
if (options.hasMore) {
resultsHtml += this.selectivity.template('loadMore');
} else if (value && Array.isArray(value) && value.includes(options?.term?.toLowerCase())) {
} else if (
value &&
Array.isArray(value) &&
value.includes(options && options.term ? options.term.toLowerCase() : options.term)
) {
resultsHtml = this.selectivity.template('tagExists');
} else if (!resultsHtml && !options.add) {
resultsHtml = this.selectivity.template('noResults', { term: options.term });
Expand Down
2 changes: 1 addition & 1 deletion ui/widgets/nuxeo-tag-suggestion.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ import { escapeHTML } from './nuxeo-selectivity.js';
}

_newEntryFormatter(term) {
term = term?.toLowerCase();
term = term ? term.toLowerCase() : term;
return { id: term, displayLabel: term, newTag: true };
}

Expand Down

0 comments on commit 72cfb20

Please sign in to comment.