Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 161x 161x 161x | import { computed, type Ref } from 'vue'
// Backend totals can lag one page behind what's already rendered (e.g. right
// after a search or a load-more), so the local items length is used as a
// floor to avoid the count briefly dropping below what's on screen.
export function useFilteredCounts(
filteredTotal: Ref<number>,
total: Ref<number>,
itemsLength: Ref<number>
) {
const filteredCount = computed(() => Math.max(filteredTotal.value, itemsLength.value))
const totalCount = computed(() => Math.max(total.value, filteredCount.value))
return { filteredCount, totalCount }
}
|