Skip to content

Commit c42f753

Browse files
committed
fix: drop unused totalPages from usePaginatedQuery
totalPages was recomputed from total/limit, duplicating a value both billing APIs already return deterministically, and the only caller (UsageLogsTable) never consumed it. Removed it from the composable's public return instead of keeping unused, potentially drifting state.
1 parent 85ded15 commit c42f753

2 files changed

Lines changed: 0 additions & 5 deletions

File tree

src/composables/usePaginatedQuery.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ describe('usePaginatedQuery', () => {
5454
expect(fetchPage).toHaveBeenCalledWith({ key: 'a', page: 1, limit: 10 })
5555
expect(api.items.value).toHaveLength(10)
5656
expect(api.total.value).toBe(25)
57-
expect(api.totalPages.value).toBe(3)
5857
expect(api.first.value).toBe(0)
5958
expect(api.loading.value).toBe(false)
6059
})

src/composables/usePaginatedQuery.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ export function usePaginatedQuery<T, K>(
5050
const page = computed(() => lastResponse.value?.page ?? 1)
5151
const limit = computed(() => lastResponse.value?.limit ?? initialLimit)
5252
const total = computed(() => lastResponse.value?.total ?? 0)
53-
const totalPages = computed(() =>
54-
total.value === 0 ? 0 : Math.ceil(total.value / limit.value)
55-
)
5653
const first = computed(() => (page.value - 1) * limit.value)
5754

5855
let requestToken = 0
@@ -92,7 +89,6 @@ export function usePaginatedQuery<T, K>(
9289
page,
9390
limit,
9491
total,
95-
totalPages,
9692
first,
9793
loading,
9894
error,

0 commit comments

Comments
 (0)