Skip to content

Commit 65b14fb

Browse files
committed
fix: fix a few more type errors
1 parent f9c28eb commit 65b14fb

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

app/components/PackageList.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ const paginationMode = computed(() =>
6969
viewMode.value === 'table' ? 'paginated' : (props.paginationMode ?? 'infinite'),
7070
)
7171
const currentPage = computed(() => props.currentPage ?? 1)
72+
const pageSize = computed(() => props.pageSize ?? 25)
73+
// Numeric page size for virtual scroll and arithmetic (when 'all' is selected, use 25 as default)
74+
const numericPageSize = computed(() => (pageSize.value === 'all' ? 25 : pageSize.value))
7275
7376
// Compute paginated results for paginated mode
7477
const displayedResults = computed(() => {
@@ -79,23 +82,22 @@ const displayedResults = computed(() => {
7982
if (pageSize.value === 'all') {
8083
return props.results
8184
}
82-
const start = (currentPage.value - 1) * pageSize.value
83-
const end = start + pageSize.value
85+
const start = (currentPage.value - 1) * numericPageSize.value
86+
const end = start + numericPageSize.value
8487
return props.results.slice(start, end)
8588
})
8689
8790
// Set up infinite scroll if hasMore is provided
8891
const hasMore = computed(() => props.hasMore ?? false)
8992
const isLoading = computed(() => props.isLoading ?? false)
9093
const itemCount = computed(() => props.results.length)
91-
const pageSize = computed(() => props.pageSize ?? 20)
9294
9395
const { handleScroll, scrollToPage } = useVirtualInfiniteScroll({
9496
listRef,
9597
itemCount,
9698
hasMore,
9799
isLoading,
98-
pageSize: pageSize.value,
100+
pageSize: numericPageSize.value,
99101
threshold: 5,
100102
onLoadMore: () => emit('loadMore'),
101103
onPageChange: page => emit('pageChange', page),

app/pages/search.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ onMounted(() => {
7171
})
7272
7373
// Infinite scroll state
74-
const pageSize = 20
74+
const pageSize = 25
7575
const loadedPages = ref(1)
7676
const isLoadingMore = ref(false)
7777

0 commit comments

Comments
 (0)