fix: sort by not using relevance as default type (#5872)

This commit is contained in:
Truman Gao
2026-04-20 14:34:40 -06:00
committed by GitHub
parent da47c50320
commit 694ab09a01
3 changed files with 4 additions and 3 deletions

View File

@@ -276,7 +276,9 @@ export function useBrowseSearch(options: UseBrowseSearchOptions): BrowseSearchSt
() => options.projectType.value,
(newType, oldType) => {
debug('projectType changed', { from: oldType, to: newType })
currentSortType.value = { display: 'Relevance', name: 'relevance' }
effectiveCurrentSortType.value =
effectiveSortTypes.value.find((sortType) => sortType.name === 'relevance') ??
effectiveSortTypes.value[0]
query.value = ''
},
)

View File

@@ -59,7 +59,6 @@ const maxResultsOptions = computed<ComboboxOption<number>[]>(() =>
:model-value="ctx.effectiveCurrentSortType.value"
:options="sortOptions"
:class="ctx.variant === 'web' ? '!w-auto flex-grow md:flex-grow-0' : 'max-w-[16rem]'"
placeholder="Sort by"
@update:model-value="(val: SortType) => (ctx.effectiveCurrentSortType.value = val)"
>
<template #prefix>

View File

@@ -115,7 +115,7 @@ export function useSearch(
{ display: 'Date updated', name: 'updated' },
])
const currentSortType: Ref<SortType> = ref({ name: 'relevance', display: 'Relevance' })
const currentSortType: Ref<SortType> = ref(sortTypes[0])
const route = useRoute()
const currentPage = ref(1)