Skip to content

Commit 07a2aa6

Browse files
refactor: remove instances of "all"
1 parent c54a0c0 commit 07a2aa6

4 files changed

Lines changed: 9 additions & 18 deletions

File tree

app/components/Package/List.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,15 @@ const paginationMode = computed(() =>
7575
)
7676
const currentPage = computed(() => props.currentPage ?? 1)
7777
const pageSize = computed(() => props.pageSize ?? 25)
78-
// Numeric page size for virtual scroll and arithmetic (when 'all' is selected, use 25 as default)
79-
const numericPageSize = computed(() => (pageSize.value === 'all' ? 25 : pageSize.value))
78+
// Numeric page size for virtual scroll and arithmetic (use 25 as default)
79+
const numericPageSize = computed(() => pageSize.value)
8080
8181
// Compute paginated results for paginated mode
8282
const displayedResults = computed(() => {
8383
if (paginationMode.value === 'infinite') {
8484
return props.results
8585
}
86-
// 'all' page size means show everything (YOLO)
87-
if (pageSize.value === 'all') {
88-
return props.results
89-
}
86+
9087
const start = (currentPage.value - 1) * numericPageSize.value
9188
const end = start + numericPageSize.value
9289
return props.results.slice(start, end)

app/components/Package/ListToolbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function getSortKeyLabelKey(key: SortKey): string {
147147
$t(
148148
'filters.count.showing_paginated',
149149
{
150-
pageSize: pageSize === 'all' ? $n(filteredCount) : Math.min(pageSize, filteredCount),
150+
pageSize: Math.min(pageSize, filteredCount),
151151
count: $n(filteredCount),
152152
},
153153
filteredCount,

app/pages/org/[org].vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ const currentPage = shallowRef(1)
6565
6666
// Calculate total pages
6767
const totalPages = computed(() => {
68-
if (pageSize.value === 'all') return 1
69-
const numericSize = typeof pageSize.value === 'number' ? pageSize.value : 25
68+
const numericSize = pageSize.value ?? 25
7069
return Math.ceil(sortedPackages.value.length / numericSize)
7170
})
7271

app/pages/search.vue

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const EAGER_LOAD_SIZE = { algolia: 500, npm: 500 } as const
164164
165165
// Calculate how many results we need based on current page and preferred page size
166166
const requestedSize = computed(() => {
167-
const numericPrefSize = preferredPageSize.value === 'all' ? 250 : preferredPageSize.value
167+
const numericPrefSize = preferredPageSize.value
168168
const base = Math.max(pageSize, currentPage.value * numericPrefSize)
169169
// When sorting by something other than relevance, fetch a large batch
170170
// so client-side sorting operates on a meaningful pool of matching results
@@ -587,10 +587,8 @@ const rawLiveRegionMessage = computed(() => {
587587
588588
if (visibleResults.value && displayResults.value.length > 0) {
589589
if (viewMode.value === 'table' || paginationMode.value === 'paginated') {
590-
const pSize =
591-
preferredPageSize.value === 'all'
592-
? $n(effectiveTotal.value)
593-
: Math.min(preferredPageSize.value, effectiveTotal.value)
590+
const pSize = Math.min(preferredPageSize.value, effectiveTotal.value)
591+
594592
return $t(
595593
'filters.count.showing_paginated',
596594
{
@@ -781,10 +779,7 @@ onBeforeUnmount(() => {
781779
$t(
782780
'filters.count.showing_paginated',
783781
{
784-
pageSize:
785-
preferredPageSize === 'all'
786-
? $n(effectiveTotal)
787-
: Math.min(preferredPageSize, effectiveTotal),
782+
pageSize: Math.min(preferredPageSize, effectiveTotal),
788783
count: $n(effectiveTotal),
789784
},
790785
effectiveTotal,

0 commit comments

Comments
 (0)