fix: make search use v3 everywhere (#6840)

This commit is contained in:
Calum H.
2026-07-23 22:16:23 +00:00
committed by GitHub
parent 5c697f675c
commit 0512e0b62b
17 changed files with 241 additions and 149 deletions
+7 -11
View File
@@ -670,7 +670,7 @@ async function getInstallProjectVersions(projectId: string) {
}
async function chooseInstanceInstallVersion(
project: Labrinth.Search.v2.ResultSearchProject & Labrinth.Search.v3.ResultSearchProject,
project: Labrinth.Search.v3.ResultSearchProject,
projectTypeValue: string,
) {
const targetInstance = instance.value
@@ -697,16 +697,14 @@ async function chooseInstanceInstallVersion(
}
function getCardActions(
result: Labrinth.Search.v2.ResultSearchProject | Labrinth.Search.v3.ResultSearchProject,
result: Labrinth.Search.v3.ResultSearchProject,
currentProjectType: string,
): CardAction[] {
if (currentProjectType === 'server') {
return getServerCardActions(result as Labrinth.Search.v3.ResultSearchProject)
return getServerCardActions(result)
}
// Non-server project actions
const projectResult = result as (Labrinth.Search.v2.ResultSearchProject &
Labrinth.Search.v3.ResultSearchProject) & {
const projectResult = result as Labrinth.Search.v3.ResultSearchProject & {
installed?: boolean
installing?: boolean
}
@@ -917,11 +915,9 @@ async function search(requestParams: string) {
}
const hits = rawResults.result.hits.map((hit) => {
const mapped = {
const mapped: Labrinth.Search.v3.ResultSearchProject & { installed?: boolean } = {
...hit,
title: hit.name,
description: hit.summary,
} as unknown as Labrinth.Search.v2.ResultSearchProject & { installed?: boolean }
}
if (instance.value || isServerContext.value) {
const installedIds = instance.value
@@ -1068,7 +1064,7 @@ provideBrowseManager({
projectType,
...searchState,
advancedFiltersCollapsed,
getProjectLink: (result: Labrinth.Search.v2.ResultSearchProject) => ({
getProjectLink: (result: Labrinth.Search.v3.ResultSearchProject) => ({
path: `/project/${result.project_id ?? result.slug}`,
query: getProjectBrowseQuery(),
}),