From 60bc70ecbb1692c94dfd9ceb9bae1415355bafed Mon Sep 17 00:00:00 2001 From: Kael Date: Thu, 17 Oct 2024 18:34:27 +1100 Subject: [PATCH] fix(VDataTable): remove page clamp on initial render fixes #17966 closes #20185 --- .../src/components/VDataTable/composables/paginate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/vuetify/src/components/VDataTable/composables/paginate.ts b/packages/vuetify/src/components/VDataTable/composables/paginate.ts index 63515ee6195..1cf90f3d9f2 100644 --- a/packages/vuetify/src/components/VDataTable/composables/paginate.ts +++ b/packages/vuetify/src/components/VDataTable/composables/paginate.ts @@ -2,7 +2,7 @@ import { useProxiedModel } from '@/composables/proxiedModel' // Utilities -import { computed, inject, provide, watch, watchEffect } from 'vue' +import { computed, inject, provide, watch } from 'vue' import { clamp, getCurrentInstance, propsFactory } from '@/util' // Types @@ -73,7 +73,8 @@ export function providePagination (options: { return Math.ceil(itemsLength.value / itemsPerPage.value) }) - watchEffect(() => { + // Don't run immediately, items may not have been loaded yet: #17966 + watch([page, pageCount], () => { if (page.value > pageCount.value) { page.value = pageCount.value }