There was an error while loading. Please reload this page.
1 parent fb8b8fd commit 4900a70Copy full SHA for 4900a70
1 file changed
app/composables/npm/useAlgoliaSearch.ts
@@ -369,10 +369,12 @@ export function useAlgoliaSearch() {
369
let packageExists: boolean | null = null
370
if (packageQueryIndex >= 0) {
371
const pkgResponse = results[packageQueryIndex] as SearchResponse<AlgoliaHit> | undefined
372
- const exactHit = pkgResponse?.hits[0]
373
- packageExists = exactHit ? exactHit.name === checks?.checkPackage : false
+ const [exactHit] = pkgResponse?.hits ?? []
+ const isExactHit = exactHit?.name === checks?.checkPackage
374
375
- if (exactHit) {
+ packageExists = isExactHit
376
+
377
+ if (exactHit && isExactHit) {
378
searchResult.objects = [
379
hitToSearchResult(exactHit),
380
...searchResult.objects.filter(result => result.package.name !== exactHit.name),
0 commit comments