Skip to content

Commit 694ab09

Browse files
authored
fix: sort by not using relevance as default type (#5872)
1 parent da47c50 commit 694ab09

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/ui/src/layouts/shared/browse-tab/composables/use-browse-search.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ export function useBrowseSearch(options: UseBrowseSearchOptions): BrowseSearchSt
276276
() => options.projectType.value,
277277
(newType, oldType) => {
278278
debug('projectType changed', { from: oldType, to: newType })
279-
currentSortType.value = { display: 'Relevance', name: 'relevance' }
279+
effectiveCurrentSortType.value =
280+
effectiveSortTypes.value.find((sortType) => sortType.name === 'relevance') ??
281+
effectiveSortTypes.value[0]
280282
query.value = ''
281283
},
282284
)

packages/ui/src/layouts/shared/browse-tab/layout.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const maxResultsOptions = computed<ComboboxOption<number>[]>(() =>
5959
:model-value="ctx.effectiveCurrentSortType.value"
6060
:options="sortOptions"
6161
:class="ctx.variant === 'web' ? '!w-auto flex-grow md:flex-grow-0' : 'max-w-[16rem]'"
62-
placeholder="Sort by"
6362
@update:model-value="(val: SortType) => (ctx.effectiveCurrentSortType.value = val)"
6463
>
6564
<template #prefix>

packages/ui/src/utils/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function useSearch(
115115
{ display: 'Date updated', name: 'updated' },
116116
])
117117

118-
const currentSortType: Ref<SortType> = ref({ name: 'relevance', display: 'Relevance' })
118+
const currentSortType: Ref<SortType> = ref(sortTypes[0])
119119

120120
const route = useRoute()
121121
const currentPage = ref(1)

0 commit comments

Comments
 (0)