TanStackT
TanStack3y ago
2 replies
urgent-maroon

PageCount not reactive

When I change the pageCount of my parent component, the tables page count .getPageCount()does not represent the current state: I already tried to explicitly set the page count through an effect but that does not work as well.

const table = useVueTable({
  get data() {
    return props.items;
  },

  columns: props.columns,
  getCoreRowModel: getCoreRowModel<T>(),
  getSortedRowModel: getSortedRowModel<T>(),
  manualPagination: true, // https://tanstack.com/table/v8/docs/api/features/pagination#table-options
  debugTable: import.meta.env.DEV,
  onPaginationChange: (page) => {
    const next = typeof page === 'function' ? page(paginationState.value) : page;

    paginationState.value.pageIndex = next.pageIndex;
  },
  pageCount: props.pageCount,
});

watchEffect(() => {
  console.log('SETPAGECOUNTCALLED', props.pageCount);
  table.setPageCount(props.pageCount);
});


Does anyone see a issue in this code?
Was this page helpful?