File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ definePageMeta({
1010const route = useRoute (' org' )
1111const router = useRouter ()
1212
13+ const DEFAULT_SORT = ' downloads-week-desc' satisfies SortOption
14+
1315const orgName = computed (() => route .params .org .toLowerCase ())
1416
1517const { isConnected } = useConnector ()
@@ -57,7 +59,7 @@ const {
5759 setSort,
5860} = useStructuredFilters ({
5961 packages ,
60- initialSort: (normalizeSearchParam (route .query .sort ) as SortOption ) ?? ' downloads-week-desc ' ,
62+ initialSort: (normalizeSearchParam (route .query .sort ) as SortOption ) ?? DEFAULT_SORT ,
6163})
6264
6365// Pagination state
@@ -86,7 +88,7 @@ const updateUrl = debounce((updates: { filter?: string; sort?: string }) => {
8688 query: {
8789 ... route .query ,
8890 q: updates .filter || undefined ,
89- sort: updates .sort && updates .sort !== ' downloads-week-desc ' ? updates .sort : undefined ,
91+ sort: updates .sort && updates .sort !== DEFAULT_SORT ? updates .sort : undefined ,
9092 },
9193 })
9294}, 300 )
@@ -112,7 +114,7 @@ const totalWeeklyDownloads = computed(() =>
112114// Reset state when org changes
113115watch (orgName , () => {
114116 clearAllFilters ()
115- setSort (' downloads-week-desc ' )
117+ setSort (DEFAULT_SORT )
116118 currentPage .value = 1
117119})
118120
You can’t perform that action at this time.
0 commit comments