mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 06:16:05 +02:00
fix: reset page index when total page count shrinks below current page
This commit is contained in:
@@ -251,6 +251,7 @@
|
|||||||
const D = previousInstancesListDialog.value;
|
const D = previousInstancesListDialog.value;
|
||||||
if (currentId.value !== D.lastId) {
|
if (currentId.value !== D.lastId) {
|
||||||
table.setPageIndex(0);
|
table.setPageIndex(0);
|
||||||
|
pageIndex.value = 0;
|
||||||
D.lastId = currentId.value;
|
D.lastId = currentId.value;
|
||||||
}
|
}
|
||||||
if (props.variant === 'user') {
|
if (props.variant === 'user') {
|
||||||
|
|||||||
@@ -629,6 +629,19 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// When the total page count shrinks below the current page
|
||||||
|
// jump to the last available page
|
||||||
|
watch(
|
||||||
|
() => props.table.getPageCount?.(),
|
||||||
|
(pageCount) => {
|
||||||
|
if (pageCount == null || pageCount <= 0) return;
|
||||||
|
const pageIndex = props.table.getState?.().pagination?.pageIndex ?? 0;
|
||||||
|
if (pageIndex >= pageCount) {
|
||||||
|
props.table.setPageIndex(pageCount - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
watch([currentPage, pageSizeProxy], async () => {
|
watch([currentPage, pageSizeProxy], async () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
if (tableScrollRef.value) {
|
if (tableScrollRef.value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user