diff --git a/public/components/searchbar/searchbar.css b/public/components/searchbar/searchbar.css index bdc90d8a..cddcc483 100644 --- a/public/components/searchbar/searchbar.css +++ b/public/components/searchbar/searchbar.css @@ -190,7 +190,7 @@ div.search-result-pannel .package>b { } div.search-result-pannel .package.hide { - display: none; + display: none !important; } div.search-result-pannel .package+.package { diff --git a/public/components/searchbar/searchbar.js b/public/components/searchbar/searchbar.js index 3053191d..bf5f8db4 100644 --- a/public/components/searchbar/searchbar.js +++ b/public/components/searchbar/searchbar.js @@ -20,12 +20,8 @@ const kHelpersTemplateName = { const fragment = document.createDocumentFragment(); const items = new Set(); - for (const { license } of linker.values()) { - if (typeof license === "string") { - items.add("Unknown"); - continue; - } - license.uniqueLicenseIds.forEach((ext) => items.add(ext)); + for (const { uniqueLicenseIds = [] } of linker.values()) { + uniqueLicenseIds.forEach((ext) => items.add(ext)); } [...items].forEach((value) => fragment.appendChild(createLineElement(value))); @@ -56,7 +52,10 @@ const kHelpersTemplateName = { const fragment = document.createDocumentFragment(); const items = new Set(); for (const { author } of linker.values()) { - items.add(typeof author === "string" ? author : author.name); + if (author === null) { + continue; + } + items.add(author.name); } [...items].forEach((value) => fragment.appendChild(createLineElement(value))); @@ -438,8 +437,9 @@ export class SearchBar { break; } case "license": { - const licences = typeof opt.license === "string" ? ["Unknown"] : [...new Set(opt.license.uniqueLicenseIds)]; - const hasMatchingLicense = licences.some((value) => new RegExp(inputValue, "gi").test(value)); + const hasMatchingLicense = opt.uniqueLicenseIds.some( + (value) => new RegExp(inputValue, "gi").test(value) + ); if (hasMatchingLicense) { matchingIds.add(String(id)); } @@ -474,8 +474,10 @@ export class SearchBar { case "author": { const authorRegex = new RegExp(inputValue, "gi"); - if ((typeof opt.author === "string" && authorRegex.test(opt.author)) || - (opt.author.name && authorRegex.test(opt.author.name))) { + if ( + (typeof opt.author === "string" && authorRegex.test(opt.author)) || + (opt.author !== null && "name" in opt.author && authorRegex.test(opt.author.name)) + ) { matchingIds.add(String(id)); } break;